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