data_pipe_control_message.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. #ifndef MOJO_CORE_DATA_PIPE_CONTROL_MESSAGE_H_
  5. #define MOJO_CORE_DATA_PIPE_CONTROL_MESSAGE_H_
  6. #include <stdint.h>
  7. #include "mojo/core/ports/port_ref.h"
  8. #include "mojo/public/c/system/macros.h"
  9. namespace mojo {
  10. namespace core {
  11. class NodeController;
  12. enum DataPipeCommand : uint32_t {
  13. // Signal to the consumer that new data is available.
  14. DATA_WAS_WRITTEN,
  15. // Signal to the producer that data has been consumed.
  16. DATA_WAS_READ,
  17. };
  18. // Message header for messages sent over a data pipe control port.
  19. struct MOJO_ALIGNAS(8) DataPipeControlMessage {
  20. DataPipeCommand command;
  21. uint32_t num_bytes;
  22. };
  23. void SendDataPipeControlMessage(NodeController* node_controller,
  24. const ports::PortRef& port,
  25. DataPipeCommand command,
  26. uint32_t num_bytes);
  27. } // namespace core
  28. } // namespace mojo
  29. #endif // MOJO_CORE_DATA_PIPE_CONTROL_MESSAGE_H_