| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "mojo/edk/system/channel.h" | 8 #include "mojo/edk/system/channel.h" |
| 9 | 9 |
| 10 namespace mojo { | 10 namespace mojo { |
| 11 namespace edk { | 11 namespace edk { |
| 12 | 12 |
| 13 #pragma pack(push, 1) | 13 #pragma pack(push, 1) |
| 14 | 14 |
| 15 enum BrokerMessageType : uint32_t { | 15 enum BrokerMessageType : uint32_t { |
| 16 INIT, | 16 INIT, |
| 17 BUFFER_REQUEST, | 17 BUFFER_REQUEST, |
| 18 BUFFER_RESPONSE, | 18 BUFFER_RESPONSE, |
| 19 }; | 19 }; |
| 20 | 20 |
| 21 struct BrokerMessageHeader { | 21 struct BrokerMessageHeader { |
| 22 BrokerMessageType type; | 22 BrokerMessageType type; |
| 23 uint32_t padding; | 23 uint32_t padding; |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 static_assert(sizeof(BrokerMessageHeader) % kChannelMessageAlignment == 0, | 26 static_assert(IsAlignedForChannelMessage(sizeof(BrokerMessageHeader)), |
| 27 "Invalid header size."); | 27 "Invalid header size."); |
| 28 | 28 |
| 29 struct BufferRequestData { | 29 struct BufferRequestData { |
| 30 uint32_t size; | 30 uint32_t size; |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 #if defined(OS_WIN) | 33 #if defined(OS_WIN) |
| 34 struct InitData { | 34 struct InitData { |
| 35 // NOTE: InitData in the payload is followed by string16 data with exactly | 35 // NOTE: InitData in the payload is followed by string16 data with exactly |
| 36 // |pipe_name_length| wide characters (i.e., |pipe_name_length|*2 bytes.) | 36 // |pipe_name_length| wide characters (i.e., |pipe_name_length|*2 bytes.) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 reinterpret_cast<BrokerMessageHeader*>(message->mutable_payload()); | 71 reinterpret_cast<BrokerMessageHeader*>(message->mutable_payload()); |
| 72 header->type = type; | 72 header->type = type; |
| 73 header->padding = 0; | 73 header->padding = 0; |
| 74 return message; | 74 return message; |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace edk | 77 } // namespace edk |
| 78 } // namespace mojo | 78 } // namespace mojo |
| 79 | 79 |
| 80 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ | 80 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ |
| OLD | NEW |