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_DATA_PIPE_CONTROL_MESSAGE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_DATA_PIPE_CONTROL_MESSAGE_H_ |
6 #define MOJO_EDK_SYSTEM_DATA_PIPE_CONTROL_MESSAGE_H_ | 6 #define MOJO_EDK_SYSTEM_DATA_PIPE_CONTROL_MESSAGE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "mojo/edk/embedder/scoped_platform_handle.h" | 12 #include "mojo/edk/embedder/scoped_platform_handle.h" |
13 #include "mojo/edk/system/ports/port_ref.h" | 13 #include "mojo/edk/system/ports/port_ref.h" |
14 #include "mojo/public/c/system/macros.h" | 14 #include "mojo/public/c/system/macros.h" |
15 | 15 |
16 namespace mojo { | 16 namespace mojo { |
17 namespace edk { | 17 namespace edk { |
18 | 18 |
19 class NodeController; | 19 class NodeController; |
20 class PortsMessage; | |
21 | 20 |
22 enum DataPipeCommand : uint32_t { | 21 enum DataPipeCommand : uint32_t { |
23 // Signal to the consumer that new data is available. | 22 // Signal to the consumer that new data is available. |
24 DATA_WAS_WRITTEN, | 23 DATA_WAS_WRITTEN, |
25 | 24 |
26 // Signal to the producer that data has been consumed. | 25 // Signal to the producer that data has been consumed. |
27 DATA_WAS_READ, | 26 DATA_WAS_READ, |
28 }; | 27 }; |
29 | 28 |
30 // Message header for messages sent over a data pipe control port. | 29 // Message header for messages sent over a data pipe control port. |
31 struct MOJO_ALIGNAS(8) DataPipeControlMessage { | 30 struct MOJO_ALIGNAS(8) DataPipeControlMessage { |
32 DataPipeCommand command; | 31 DataPipeCommand command; |
33 uint32_t num_bytes; | 32 uint32_t num_bytes; |
34 }; | 33 }; |
35 | 34 |
36 void SendDataPipeControlMessage(NodeController* node_controller, | 35 void SendDataPipeControlMessage(NodeController* node_controller, |
37 const ports::PortRef& port, | 36 const ports::PortRef& port, |
38 DataPipeCommand command, | 37 DataPipeCommand command, |
39 uint32_t num_bytes); | 38 uint32_t num_bytes); |
40 | 39 |
41 } // namespace edk | 40 } // namespace edk |
42 } // namespace mojo | 41 } // namespace mojo |
43 | 42 |
44 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_CONTROL_MESSAGE_H_ | 43 #endif // MOJO_EDK_SYSTEM_DATA_PIPE_CONTROL_MESSAGE_H_ |
OLD | NEW |