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_PORTS_EVENT_H_ | 5 #ifndef MOJO_EDK_SYSTEM_PORTS_EVENT_H_ |
6 #define MOJO_EDK_SYSTEM_PORTS_EVENT_H_ | 6 #define MOJO_EDK_SYSTEM_PORTS_EVENT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "mojo/edk/system/ports/message.h" | 10 #include "mojo/edk/system/ports/message.h" |
11 #include "mojo/edk/system/ports/name.h" | 11 #include "mojo/edk/system/ports/name.h" |
12 #include "mojo/public/c/system/macros.h" | |
13 | 12 |
14 namespace mojo { | 13 namespace mojo { |
15 namespace edk { | 14 namespace edk { |
16 namespace ports { | 15 namespace ports { |
17 | 16 |
18 // TODO: Add static assertions of alignment. | 17 struct PortDescriptor { |
| 18 PortDescriptor(); |
| 19 ~PortDescriptor(); |
19 | 20 |
20 struct MOJO_ALIGNAS(8) PortDescriptor { | |
21 NodeName peer_node_name; | 21 NodeName peer_node_name; |
22 PortName peer_port_name; | 22 PortName peer_port_name; |
23 NodeName referring_node_name; | 23 NodeName referring_node_name; |
24 PortName referring_port_name; | 24 PortName referring_port_name; |
25 uint64_t next_sequence_num_to_send; | 25 uint64_t next_sequence_num_to_send; |
26 uint64_t next_sequence_num_to_receive; | 26 uint64_t next_sequence_num_to_receive; |
27 uint64_t last_sequence_num_to_receive; | 27 uint64_t last_sequence_num_to_receive; |
28 bool peer_closed; | 28 bool peer_closed; |
| 29 uint8_t padding0; |
| 30 uint16_t padding1; |
| 31 uint32_t padding2; |
29 }; | 32 }; |
30 | 33 |
31 enum struct EventType : uint32_t { | 34 enum EventType : uint32_t { |
32 kUser, | 35 kUser, |
33 kPortAccepted, | 36 kPortAccepted, |
34 kObserveProxy, | 37 kObserveProxy, |
35 kObserveProxyAck, | 38 kObserveProxyAck, |
36 kObserveClosure, | 39 kObserveClosure, |
37 }; | 40 }; |
38 | 41 |
39 struct EventHeader { | 42 struct EventHeader { |
40 EventType type; | 43 EventType type; |
41 uint32_t padding; | 44 uint32_t padding; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 93 |
91 inline PortDescriptor* GetMutablePortDescriptors(UserEventData* event) { | 94 inline PortDescriptor* GetMutablePortDescriptors(UserEventData* event) { |
92 return reinterpret_cast<PortDescriptor*>(reinterpret_cast<char*>(event + 1)); | 95 return reinterpret_cast<PortDescriptor*>(reinterpret_cast<char*>(event + 1)); |
93 } | 96 } |
94 | 97 |
95 } // namespace ports | 98 } // namespace ports |
96 } // namespace edk | 99 } // namespace edk |
97 } // namespace mojo | 100 } // namespace mojo |
98 | 101 |
99 #endif // MOJO_EDK_SYSTEM_PORTS_EVENT_H_ | 102 #endif // MOJO_EDK_SYSTEM_PORTS_EVENT_H_ |
OLD | NEW |