Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: mojo/edk/system/ports/node.h

Issue 2236473003: [mojo-edk] Revert ObserveProxy retransmission behavior (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/node_controller.cc ('k') | mojo/edk/system/ports/node.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_EDK_SYSTEM_PORTS_NODE_H_ 5 #ifndef MOJO_EDK_SYSTEM_PORTS_NODE_H_
6 #define MOJO_EDK_SYSTEM_PORTS_NODE_H_ 6 #define MOJO_EDK_SYSTEM_PORTS_NODE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 30 matching lines...) Expand all
41 struct PortStatus { 41 struct PortStatus {
42 bool has_messages; 42 bool has_messages;
43 bool receiving_messages; 43 bool receiving_messages;
44 bool peer_closed; 44 bool peer_closed;
45 }; 45 };
46 46
47 class NodeDelegate; 47 class NodeDelegate;
48 48
49 class Node { 49 class Node {
50 public: 50 public:
51 enum class ShutdownPolicy {
52 DONT_ALLOW_LOCAL_PORTS,
53 ALLOW_LOCAL_PORTS,
54 };
55
51 // Does not take ownership of the delegate. 56 // Does not take ownership of the delegate.
52 Node(const NodeName& name, NodeDelegate* delegate); 57 Node(const NodeName& name, NodeDelegate* delegate);
53 ~Node(); 58 ~Node();
54 59
55 // Returns true iff there are no open ports referring to another node or ports 60 // Returns true iff there are no open ports referring to another node or ports
56 // in the process of being transferred from this node to another. If this 61 // in the process of being transferred from this node to another. If this
57 // returns false, then to ensure clean shutdown, it is necessary to keep the 62 // returns false, then to ensure clean shutdown, it is necessary to keep the
58 // node alive and continue routing messages to it via AcceptMessage. This 63 // node alive and continue routing messages to it via AcceptMessage. This
59 // method may be called again after AcceptMessage to check if the Node is now 64 // method may be called again after AcceptMessage to check if the Node is now
60 // ready to be destroyed. 65 // ready to be destroyed.
61 // 66 //
62 // If |allow_local_ports| is |true|, this will only return |false| when there 67 // If |policy| is set to |ShutdownPolicy::ALLOW_LOCAL_PORTS|, this will return
63 // are transient ports referring to other nodes. 68 // |true| even if some ports remain alive, as long as none of them are proxies
64 bool CanShutdownCleanly(bool allow_local_ports); 69 // to another node.
70 bool CanShutdownCleanly(
71 ShutdownPolicy policy = ShutdownPolicy::DONT_ALLOW_LOCAL_PORTS);
65 72
66 // Lookup the named port. 73 // Lookup the named port.
67 int GetPort(const PortName& port_name, PortRef* port_ref); 74 int GetPort(const PortName& port_name, PortRef* port_ref);
68 75
69 // Creates a port on this node. Before the port can be used, it must be 76 // Creates a port on this node. Before the port can be used, it must be
70 // initialized using InitializePort. This method is useful for bootstrapping 77 // initialized using InitializePort. This method is useful for bootstrapping
71 // a connection between two nodes. Generally, ports are created using 78 // a connection between two nodes. Generally, ports are created using
72 // CreatePortPair instead. 79 // CreatePortPair instead.
73 int CreateUninitializedPort(PortRef* port_ref); 80 int CreateUninitializedPort(PortRef* port_ref);
74 81
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 std::unordered_map<PortName, scoped_refptr<Port>> ports_; 220 std::unordered_map<PortName, scoped_refptr<Port>> ports_;
214 221
215 DISALLOW_COPY_AND_ASSIGN(Node); 222 DISALLOW_COPY_AND_ASSIGN(Node);
216 }; 223 };
217 224
218 } // namespace ports 225 } // namespace ports
219 } // namespace edk 226 } // namespace edk
220 } // namespace mojo 227 } // namespace mojo
221 228
222 #endif // MOJO_EDK_SYSTEM_PORTS_NODE_H_ 229 #endif // MOJO_EDK_SYSTEM_PORTS_NODE_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/node_controller.cc ('k') | mojo/edk/system/ports/node.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698