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

Side by Side Diff: mojo/edk/system/node_controller.h

Issue 1685183004: Bootstrap Mojo IPC independent of Chrome IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: and fix posix Created 4 years, 10 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
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_NODE_CONTROLLER_H_ 5 #ifndef MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_
6 #define MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_ 6 #define MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_
7 7
8 #include <queue> 8 #include <queue>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <unordered_set> 10 #include <unordered_set>
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 scoped_refptr<base::TaskRunner> io_task_runner() const { 55 scoped_refptr<base::TaskRunner> io_task_runner() const {
56 return io_task_runner_; 56 return io_task_runner_;
57 } 57 }
58 58
59 // Called exactly once, shortly after construction, and before any other 59 // Called exactly once, shortly after construction, and before any other
60 // methods are called on this object. 60 // methods are called on this object.
61 void SetIOTaskRunner(scoped_refptr<base::TaskRunner> io_task_runner); 61 void SetIOTaskRunner(scoped_refptr<base::TaskRunner> io_task_runner);
62 62
63 // Connects this node to a child node. This node will initiate a handshake. 63 // Connects this node to a child node. This node will initiate a handshake.
64 void ConnectToChild(base::ProcessHandle process_handle, 64 void ConnectToChild(base::ProcessHandle process_handle,
65 ScopedPlatformHandle platform_handle); 65 ScopedPlatformHandle platform_handle,
66 const std::string& secret);
66 67
67 // Connects this node to a parent node. The parent node will initiate a 68 // Connects this node to a parent node. The parent node will initiate a
68 // handshake. 69 // handshake.
69 void ConnectToParent(ScopedPlatformHandle platform_handle); 70 void ConnectToParent(ScopedPlatformHandle platform_handle,
71 const std::string& secret);
70 72
71 // Sets a port's observer. If |observer| is null the port's current observer 73 // Sets a port's observer. If |observer| is null the port's current observer
72 // is removed. 74 // is removed.
73 void SetPortObserver(const ports::PortRef& port, 75 void SetPortObserver(const ports::PortRef& port,
74 const scoped_refptr<PortObserver>& observer); 76 const scoped_refptr<PortObserver>& observer);
75 77
76 // Closes a port. Use this in lieu of calling Node::ClosePort() directly, as 78 // Closes a port. Use this in lieu of calling Node::ClosePort() directly, as
77 // it ensures the port's observer has also been removed. 79 // it ensures the port's observer has also been removed.
78 void ClosePort(const ports::PortRef& port); 80 void ClosePort(const ports::PortRef& port);
79 81
(...skipping 23 matching lines...) Expand all
103 void RequestShutdown(const base::Closure& callback); 105 void RequestShutdown(const base::Closure& callback);
104 106
105 private: 107 private:
106 friend Core; 108 friend Core;
107 109
108 using NodeMap = std::unordered_map<ports::NodeName, 110 using NodeMap = std::unordered_map<ports::NodeName,
109 scoped_refptr<NodeChannel>>; 111 scoped_refptr<NodeChannel>>;
110 using OutgoingMessageQueue = std::queue<Channel::MessagePtr>; 112 using OutgoingMessageQueue = std::queue<Channel::MessagePtr>;
111 113
112 void ConnectToChildOnIOThread(base::ProcessHandle process_handle, 114 void ConnectToChildOnIOThread(base::ProcessHandle process_handle,
113 ScopedPlatformHandle platform_handle); 115 ScopedPlatformHandle platform_handle,
114 void ConnectToParentOnIOThread(ScopedPlatformHandle platform_handle); 116 const std::string& secret);
117 void ConnectToParentOnIOThread(ScopedPlatformHandle platform_handle,
118 const std::string& secret);
115 119
116 scoped_refptr<NodeChannel> GetPeerChannel(const ports::NodeName& name); 120 scoped_refptr<NodeChannel> GetPeerChannel(const ports::NodeName& name);
117 scoped_refptr<NodeChannel> GetParentChannel(); 121 scoped_refptr<NodeChannel> GetParentChannel();
118 scoped_refptr<NodeChannel> GetBrokerChannel(); 122 scoped_refptr<NodeChannel> GetBrokerChannel();
119 123
120 void AddPeer(const ports::NodeName& name, 124 void AddPeer(const ports::NodeName& name,
121 scoped_refptr<NodeChannel> channel, 125 scoped_refptr<NodeChannel> channel,
122 bool start_channel); 126 bool start_channel);
123 void DropPeer(const ports::NodeName& name); 127 void DropPeer(const ports::NodeName& name);
124 void SendPeerMessage(const ports::NodeName& name, 128 void SendPeerMessage(const ports::NodeName& name,
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 scoped_ptr<Broker> broker_; 259 scoped_ptr<Broker> broker_;
256 #endif 260 #endif
257 261
258 DISALLOW_COPY_AND_ASSIGN(NodeController); 262 DISALLOW_COPY_AND_ASSIGN(NodeController);
259 }; 263 };
260 264
261 } // namespace edk 265 } // namespace edk
262 } // namespace mojo 266 } // namespace mojo
263 267
264 #endif // MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_ 268 #endif // MOJO_EDK_SYSTEM_NODE_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698