| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" | 10 #include "mojo/public/cpp/bindings/lib/bindings_internal.h" |
| 11 | 11 |
| 12 namespace mojo { | 12 namespace mojo { |
| 13 namespace internal { | 13 namespace internal { |
| 14 | 14 |
| 15 #pragma pack(push, 1) | 15 #pragma pack(push, 1) |
| 16 | 16 |
| 17 enum { kMessageExpectsResponse = 1 << 0, kMessageIsResponse = 1 << 1 }; | 17 enum { |
| 18 kMessageExpectsResponse = 1 << 0, |
| 19 kMessageIsResponse = 1 << 1, |
| 20 kMessageIsSync = 1 << 2 |
| 21 }; |
| 18 | 22 |
| 19 struct MessageHeader : internal::StructHeader { | 23 struct MessageHeader : internal::StructHeader { |
| 20 // Interface ID for identifying multiple interfaces running on the same | 24 // Interface ID for identifying multiple interfaces running on the same |
| 21 // message pipe. | 25 // message pipe. |
| 22 uint32_t interface_id; | 26 uint32_t interface_id; |
| 23 // Message name, which is scoped to the interface that the message belongs to. | 27 // Message name, which is scoped to the interface that the message belongs to. |
| 24 uint32_t name; | 28 uint32_t name; |
| 25 // 0 or either of the enum values defined above. | 29 // 0 or either of the enum values defined above. |
| 26 uint32_t flags; | 30 uint32_t flags; |
| 27 // Unused padding to make the struct size a multiple of 8 bytes. | 31 // Unused padding to make the struct size a multiple of 8 bytes. |
| 28 uint32_t padding; | 32 uint32_t padding; |
| 29 }; | 33 }; |
| 30 static_assert(sizeof(MessageHeader) == 24, "Bad sizeof(MessageHeader)"); | 34 static_assert(sizeof(MessageHeader) == 24, "Bad sizeof(MessageHeader)"); |
| 31 | 35 |
| 32 struct MessageHeaderWithRequestID : MessageHeader { | 36 struct MessageHeaderWithRequestID : MessageHeader { |
| 33 // Only used if either kMessageExpectsResponse or kMessageIsResponse is set in | 37 // Only used if either kMessageExpectsResponse or kMessageIsResponse is set in |
| 34 // order to match responses with corresponding requests. | 38 // order to match responses with corresponding requests. |
| 35 uint64_t request_id; | 39 uint64_t request_id; |
| 36 }; | 40 }; |
| 37 static_assert(sizeof(MessageHeaderWithRequestID) == 32, | 41 static_assert(sizeof(MessageHeaderWithRequestID) == 32, |
| 38 "Bad sizeof(MessageHeaderWithRequestID)"); | 42 "Bad sizeof(MessageHeaderWithRequestID)"); |
| 39 | 43 |
| 40 #pragma pack(pop) | 44 #pragma pack(pop) |
| 41 | 45 |
| 42 } // namespace internal | 46 } // namespace internal |
| 43 } // namespace mojo | 47 } // namespace mojo |
| 44 | 48 |
| 45 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ | 49 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_MESSAGE_INTERNAL_H_ |
| OLD | NEW |