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

Side by Side 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: sync 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ 5 #ifndef MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_
6 #define MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ 6 #define MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/process/process_handle.h" 11 #include "base/process/process_handle.h"
12 12
13 namespace mojo { 13 namespace mojo {
14 namespace edk { 14 namespace edk {
15 15
16 // Pack all structs here. 16 // Pack all structs here.
17 #pragma pack(push, 1) 17 #pragma pack(push, 1)
18 18
19 // This header defines the message format between ChildBroker and 19 // This header defines the message format between ChildBroker and
20 // ChildBrokerHost. 20 // ChildBrokerHost.
21 21
22 // Sandbox processes need the parent's help to create shared buffers.
23 // They are sent synchronously from child to parent and each have
24 // a response. They are sent over a raw pipe.
25 enum SandboxMessages : uint32_t {
22 #if defined(OS_WIN) 26 #if defined(OS_WIN)
23 // Windows only messages needed because sandboxed child processes need the
24 // parent's help. They are sent synchronously from child to parent and each have
25 // a response. They are sent over a raw pipe.
26 enum WindowsSandboxMessages : uint32_t {
27 // The reply is two HANDLEs. 27 // The reply is two HANDLEs.
28 CREATE_PLATFORM_CHANNEL_PAIR = 0, 28 CREATE_PLATFORM_CHANNEL_PAIR = 0,
29 // The reply is tokens of the same count of passed in handles. 29 // The reply is tokens of the same count of passed in handles.
30 HANDLE_TO_TOKEN, 30 HANDLE_TO_TOKEN,
31 // The reply is handles of the same count of passed in tokens. 31 // The reply is handles of the same count of passed in tokens.
32 TOKEN_TO_HANDLE, 32 TOKEN_TO_HANDLE,
33 #else
34 // The reply is a PlatformHandle.
35 CREATE_SHARED_BUFFER = 0,
36 #endif
33 }; 37 };
34 38
35 // Definitions of the raw bytes sent in messages. 39 // Definitions of the raw bytes sent in messages.
36 40
37 struct BrokerMessage { 41 struct BrokerMessage {
38 uint32_t size; 42 uint32_t size;
39 WindowsSandboxMessages id; 43 SandboxMessages id;
44
45 #if defined(OS_WIN)
40 // Data, if any, follows. 46 // Data, if any, follows.
41 union { 47 union {
42 HANDLE handles[1]; // If HANDLE_TO_TOKEN. 48 HANDLE handles[1]; // If HANDLE_TO_TOKEN.
43 uint64_t tokens[1]; // If TOKEN_TO_HANDLE. 49 uint64_t tokens[1]; // If TOKEN_TO_HANDLE.
44 }; 50 };
51 #else
52 uint32_t shared_buffer_size; // Size of the shared buffer to create.
53 #endif
45 }; 54 };
46 55
47 const int kBrokerMessageHeaderSize = 56 const int kBrokerMessageHeaderSize = sizeof(uint32_t) + sizeof(SandboxMessages);
48 sizeof(uint32_t) + sizeof(WindowsSandboxMessages);
49
50 #endif
51 57
52 // Route id used for messages between ChildBroker and ChildBrokerHost. 58 // Route id used for messages between ChildBroker and ChildBrokerHost.
53 const uint64_t kBrokerRouteId = 1; 59 const uint64_t kBrokerRouteId = 1;
54 60
55 // Multiplexing related messages. They are all asynchronous messages. 61 // Multiplexing related messages. They are all asynchronous messages.
56 // They are sent over RawChannel. 62 // They are sent over RawChannel.
57 enum MultiplexMessages : uint32_t { 63 enum MultiplexMessages : uint32_t {
58 // Messages from child to parent. 64 // Messages from child to parent.
59 65
60 // Tells the parent that the given pipe id has been bound to a 66 // Tells the parent that the given pipe id has been bound to a
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 MultiplexMessages type; // PEER_DIED 111 MultiplexMessages type; // PEER_DIED
106 uint64_t pipe_id; 112 uint64_t pipe_id;
107 }; 113 };
108 114
109 #pragma pack(pop) 115 #pragma pack(pop)
110 116
111 } // namespace edk 117 } // namespace edk
112 } // namespace mojo 118 } // namespace mojo
113 119
114 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ 120 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_
OLDNEW
« 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