Chromium Code Reviews| Index: mojo/edk/system/broker_messages.h |
| diff --git a/mojo/edk/system/broker_messages.h b/mojo/edk/system/broker_messages.h |
| index 351cbe6d5539ec5e8a4b5d366fac7051820e4ba0..bcee36e2d09a3a424e573b18667411fa28f2e15d 100644 |
| --- a/mojo/edk/system/broker_messages.h |
| +++ b/mojo/edk/system/broker_messages.h |
| @@ -8,6 +8,7 @@ |
| #include <stdint.h> |
| #include "base/compiler_specific.h" |
| +#include "base/process/process_handle.h" |
| namespace mojo { |
| namespace edk { |
| @@ -15,7 +16,11 @@ namespace edk { |
| // This header defines the message format between ChildBroker and |
| // ChildBrokerHost. |
| -enum MessageId { |
| +#if defined(OS_WIN) |
| +// Windows only messages needed because sandboxed child processes need the |
| +// parent's help. They are sent synchronously from child to parent and each have |
| +// a response. They are sent over a raw pipe. |
| +enum WindowsSandboxMessages { |
| // The reply is two HANDLEs. |
| CREATE_PLATFORM_CHANNEL_PAIR = 0, |
| // The reply is tokens of the same count of passed in handles. |
| @@ -28,17 +33,47 @@ enum MessageId { |
| struct BrokerMessage { |
| uint32_t size; |
| - MessageId id; |
| + WindowsSandboxMessages id; |
| // Data, if any, follows. |
| union { |
| -#if defined(OS_WIN) |
| HANDLE handles[1]; // If HANDLE_TO_TOKEN. |
| uint64_t tokens[1]; // If TOKEN_TO_HANDLE. |
| -#endif |
| }; |
| }; |
| -const int kBrokerMessageHeaderSize = sizeof(uint32_t) + sizeof(MessageId); |
| +const int kBrokerMessageHeaderSize = |
|
Tom Sepez
2015/12/03 23:35:28
Actually, this hasn't been 100% correct since it d
jam
2015/12/04 00:43:47
This is only used on Windows and there's no paddin
|
| + sizeof(uint32_t) + sizeof(WindowsSandboxMessages); |
| + |
| +#endif |
| + |
| +// Multiplexing related messages. They are all asynchronous messages. |
| +// They are sent over RawChannel. |
| +enum MultiplexMessages { |
| +// Messages from child to parent. |
|
Tom Sepez
2015/12/03 23:35:28
nit: indent.
jam
2015/12/04 00:43:47
i had meant to put it like this to separate out bo
|
| + CONNECT_MESSAGE_PIPE = 0, |
| + CANCEL_CONNECT_MESSAGE_PIPE, |
| +// Messages from parent to child. |
| + CONNECT_TO_PROCESS, |
| + PEER_PIPE_CONNECTED, |
| +}; |
| + |
| +struct ConnectMessagePipeMessage { |
| + // CONNECT_MESSAGE_PIPE or CANCEL_CONNECT_MESSAGE_PIPE |
| + MultiplexMessages type; |
| + uint64_t pipe_id; |
| +}; |
| + |
| +struct ConnectToProcessMessage { |
| + MultiplexMessages type; // CONNECT_TO_PROCESS |
| + base::ProcessId process_id; |
| + // Also has an attached platform handle. |
| +}; |
| + |
| +struct PeerPipeConnectedMessage { |
| + MultiplexMessages type; // PEER_PIPE_CONNECTED |
| + uint64_t pipe_id; |
| + base::ProcessId process_id; |
| +}; |
| } // namespace edk |
| } // namespace mojo |