OLD | NEW |
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_TOKEN_SERIALIZER_MESSAGES_WIN_H_ | 5 #ifndef MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ |
6 #define MOJO_EDK_SYSTEM_TOKEN_SERIALIZER_MESSAGES_WIN_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 | 11 |
12 namespace mojo { | 12 namespace mojo { |
13 namespace edk { | 13 namespace edk { |
14 | 14 |
15 // This header defines the message format between ChildTokenSerializer and | 15 // This header defines the message format between ChildBroker and |
16 // ParentTokenSerializer. | 16 // ChildBrokerHost. |
17 | 17 |
18 enum MessageId { | 18 enum MessageId { |
19 // The reply is two HANDLEs. | 19 // The reply is two HANDLEs. |
20 CREATE_PLATFORM_CHANNEL_PAIR = 0, | 20 CREATE_PLATFORM_CHANNEL_PAIR = 0, |
21 // The reply is tokens of the same count of passed in handles. | 21 // The reply is tokens of the same count of passed in handles. |
22 HANDLE_TO_TOKEN, | 22 HANDLE_TO_TOKEN, |
23 // The reply is handles of the same count of passed in tokens. | 23 // The reply is handles of the same count of passed in tokens. |
24 TOKEN_TO_HANDLE, | 24 TOKEN_TO_HANDLE, |
25 }; | 25 }; |
26 | 26 |
27 // Definitions of the raw bytes sent between ChildTokenSerializer and | 27 // Definitions of the raw bytes sent in messages. |
28 // ParentTokenSerializer. | |
29 | 28 |
30 struct ALIGNAS(4) TokenSerializerMessage { | 29 struct ALIGNAS(4) BrokerMessage { |
31 uint32_t size; | 30 uint32_t size; |
32 MessageId id; | 31 MessageId id; |
33 // Data, if any, follows. | 32 // Data, if any, follows. |
34 union { | 33 union { |
| 34 #if defined(OS_WIN) |
35 HANDLE handles[1]; // If HANDLE_TO_TOKEN. | 35 HANDLE handles[1]; // If HANDLE_TO_TOKEN. |
36 uint64_t tokens[1]; // If TOKEN_TO_HANDLE. | 36 uint64_t tokens[1]; // If TOKEN_TO_HANDLE. |
| 37 #endif |
37 }; | 38 }; |
38 }; | 39 }; |
39 | 40 |
40 const int kTokenSerializerMessageHeaderSize = | 41 const int kBrokerMessageHeaderSize = sizeof(uint32_t) + sizeof(MessageId); |
41 sizeof(uint32_t) + sizeof(MessageId); | |
42 | 42 |
43 } // namespace edk | 43 } // namespace edk |
44 } // namespace mojo | 44 } // namespace mojo |
45 | 45 |
46 #endif // MOJO_EDK_SYSTEM_TOKEN_SERIALIZER_MESSAGES_WIN_H_ | 46 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ |
OLD | NEW |