| Index: mojo/edk/system/ports/node_delegate.h
|
| diff --git a/mojo/edk/system/ports/node_delegate.h b/mojo/edk/system/ports/node_delegate.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7e15e7ea75e0cd196f0f9eeda6920caebd6c5f12
|
| --- /dev/null
|
| +++ b/mojo/edk/system/ports/node_delegate.h
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef MOJO_EDK_SYSTEM_PORTS_NODE_DELEGATE_H_
|
| +#define MOJO_EDK_SYSTEM_PORTS_NODE_DELEGATE_H_
|
| +
|
| +#include <stddef.h>
|
| +
|
| +#include "mojo/edk/system/ports/message.h"
|
| +#include "mojo/edk/system/ports/name.h"
|
| +#include "mojo/edk/system/ports/port_ref.h"
|
| +
|
| +namespace mojo {
|
| +namespace edk {
|
| +namespace ports {
|
| +
|
| +class NodeDelegate {
|
| + public:
|
| + virtual ~NodeDelegate() {}
|
| +
|
| + // Port names should be difficult to guess.
|
| + virtual void GenerateRandomPortName(PortName* port_name) = 0;
|
| +
|
| + // Allocate a message, including a header that can be used by the Node
|
| + // implementation. |num_header_bytes| will be aligned. The newly allocated
|
| + // memory need not be zero-filled.
|
| + virtual void AllocMessage(size_t num_header_bytes,
|
| + ScopedMessage* message) = 0;
|
| +
|
| + // Forward a message asynchronously to the specified node. This method MUST
|
| + // NOT synchronously call any methods on Node.
|
| + virtual void ForwardMessage(const NodeName& node, ScopedMessage message) = 0;
|
| +
|
| + // Indicates that the port's status has changed recently. Use Node::GetStatus
|
| + // to query the latest status of the port. Note, this event could be spurious
|
| + // if another thread is simultaneously modifying the status of the port.
|
| + virtual void PortStatusChanged(const PortRef& port_ref) = 0;
|
| +};
|
| +
|
| +} // namespace ports
|
| +} // namespace edk
|
| +} // namespace mojo
|
| +
|
| +#endif // MOJO_EDK_SYSTEM_PORTS_NODE_DELEGATE_H_
|
|
|