OLD | NEW |
(Empty) | |
| 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_PORTS_NODE_DELEGATE_H_ |
| 6 #define MOJO_EDK_SYSTEM_PORTS_NODE_DELEGATE_H_ |
| 7 |
| 8 #include <stddef.h> |
| 9 |
| 10 #include "mojo/edk/system/ports/message.h" |
| 11 #include "mojo/edk/system/ports/name.h" |
| 12 #include "mojo/edk/system/ports/port_ref.h" |
| 13 |
| 14 namespace mojo { |
| 15 namespace edk { |
| 16 namespace ports { |
| 17 |
| 18 class NodeDelegate { |
| 19 public: |
| 20 virtual ~NodeDelegate() {} |
| 21 |
| 22 // Port names should be difficult to guess. |
| 23 virtual void GenerateRandomPortName(PortName* port_name) = 0; |
| 24 |
| 25 // Allocate a message, including a header that can be used by the Node |
| 26 // implementation. |num_header_bytes| will be aligned. The newly allocated |
| 27 // memory need not be zero-filled. |
| 28 virtual void AllocMessage(size_t num_header_bytes, |
| 29 ScopedMessage* message) = 0; |
| 30 |
| 31 // Forward a message asynchronously to the specified node. This method MUST |
| 32 // NOT synchronously call any methods on Node. |
| 33 virtual void ForwardMessage(const NodeName& node, ScopedMessage message) = 0; |
| 34 |
| 35 // Indicates that the port's status has changed recently. Use Node::GetStatus |
| 36 // to query the latest status of the port. Note, this event could be spurious |
| 37 // if another thread is simultaneously modifying the status of the port. |
| 38 virtual void PortStatusChanged(const PortRef& port_ref) = 0; |
| 39 }; |
| 40 |
| 41 } // namespace ports |
| 42 } // namespace edk |
| 43 } // namespace mojo |
| 44 |
| 45 #endif // MOJO_EDK_SYSTEM_PORTS_NODE_DELEGATE_H_ |
OLD | NEW |