#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#ifndef MOJO_CORE_BROKER_MESSAGES_H_
#define MOJO_CORE_BROKER_MESSAGES_H_
#include "build/build_config.h"
#include "mojo/core/channel.h"
namespace mojo {
namespace core {
#pragma pack(push, 1)
enum BrokerMessageType : uint32_t { … };
struct BrokerMessageHeader { … };
static_assert …;
struct BufferRequestData { … };
struct BufferResponseData { … };
#if BUILDFLAG(IS_WIN)
struct InitData {
uint32_t pipe_name_length;
};
#endif
#pragma pack(pop)
template <typename T>
inline bool GetBrokerMessageData(Channel::Message* message, T** out_data) { … }
template <typename T>
inline Channel::MessagePtr CreateBrokerMessage(
BrokerMessageType type,
size_t num_handles,
size_t extra_data_size,
T** out_message_data,
void** out_extra_data = nullptr) { … }
inline Channel::MessagePtr CreateBrokerMessage(
BrokerMessageType type,
size_t num_handles,
std::nullptr_t** dummy_out_data) { … }
}
}
#endif