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

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

Issue 1555273002: [mojo] Add CreateSharedBuffer method to Broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months 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
Index: mojo/edk/system/broker_messages.h
diff --git a/mojo/edk/system/broker_messages.h b/mojo/edk/system/broker_messages.h
index 0ce0960d685b9fadc8e0cb5c1c0c7adf936bfd2c..1e386cf6c544adbd3e70e8ecf88b4bd6b1d114b2 100644
--- a/mojo/edk/system/broker_messages.h
+++ b/mojo/edk/system/broker_messages.h
@@ -16,35 +16,41 @@ namespace edk {
// This header defines the message format between ChildBroker and
// ChildBrokerHost.
-#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
+// Sandbox processes need the parent's help to create shared buffers.
+// They are sent synchronously from child to parent and each have
// a response. They are sent over a raw pipe.
-enum WindowsSandboxMessages {
+enum SandboxMessages {
Anand Mistry (off Chromium) 2016/01/07 04:36:33 Not your fault, but these should have a uint32_t s
Eliot Courtney 2016/01/07 05:01:30 Acknowledged.
+#if defined(OS_WIN)
// The reply is two HANDLEs.
CREATE_PLATFORM_CHANNEL_PAIR = 0,
// The reply is tokens of the same count of passed in handles.
HANDLE_TO_TOKEN,
// The reply is handles of the same count of passed in tokens.
TOKEN_TO_HANDLE,
+#else
+ // The reply is a PlatformHandle.
+ CREATE_SHARED_BUFFER = 0,
+#endif
};
// Definitions of the raw bytes sent in messages.
struct BrokerMessage {
uint32_t size;
- WindowsSandboxMessages id;
+ SandboxMessages id;
+
+#if defined(OS_WIN)
// Data, if any, follows.
union {
HANDLE handles[1]; // If HANDLE_TO_TOKEN.
uint64_t tokens[1]; // If TOKEN_TO_HANDLE.
};
+#else
+ uint32_t num_bytes; // Size of the shared buffer to create.
Anand Mistry (off Chromium) 2016/01/07 04:36:33 Maybe call it shared_buffer_size instead. num_byte
Eliot Courtney 2016/01/07 05:01:30 Done.
+#endif
};
-const int kBrokerMessageHeaderSize =
- sizeof(uint32_t) + sizeof(WindowsSandboxMessages);
-
-#endif
+const int kBrokerMessageHeaderSize = sizeof(uint32_t) + sizeof(SandboxMessages);
// Route id used for messages between ChildBroker and ChildBrokerHost.
const uint64_t kBrokerRouteId = 1;

Powered by Google App Engine
This is Rietveld 408576698