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