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_PORTS_NODE_DELEGATE_H_ 6 #define MOJO_CORE_PORTS_NODE_DELEGATE_H_ 7 8 #include <stddef.h> 9 10 #include "mojo/core/ports/event.h" 11 #include "mojo/core/ports/name.h" 12 #include "mojo/core/ports/port_ref.h" 13 14 namespace mojo { 15 namespace core { 16 namespace ports { 17 18 class NodeDelegate { 19 public: ~NodeDelegate()20 virtual ~NodeDelegate() {} 21 22 // Forward an event (possibly asynchronously) to the specified node. 23 virtual void ForwardEvent(const NodeName& node, ScopedEvent event) = 0; 24 25 // Broadcast an event to all nodes. 26 virtual void BroadcastEvent(ScopedEvent event) = 0; 27 28 // Indicates that the port's status has changed recently. Use Node::GetStatus 29 // to query the latest status of the port. Note, this event could be spurious 30 // if another thread is simultaneously modifying the status of the port. 31 virtual void PortStatusChanged(const PortRef& port_ref) = 0; 32 }; 33 34 } // namespace ports 35 } // namespace core 36 } // namespace mojo 37 38 #endif // MOJO_CORE_PORTS_NODE_DELEGATE_H_ 39