Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1026)

Unified Diff: mojo/edk/system/broker_messages.h

Issue 1488853002: Add multiplexing of message pipes in the new EDK. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tsepez review comments Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/broker.h ('k') | mojo/edk/system/broker_state.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..7d8946d7cb4ea6ee67165130c0ff4337433103dd 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,48 @@ 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 =
+ 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.
+ 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
« no previous file with comments | « mojo/edk/system/broker.h ('k') | mojo/edk/system/broker_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698