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

Unified Diff: mojo/edk/system/node_controller.h

Issue 2227553002: Support mojo connections between unrelated peer processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/edk/system/node_channel.cc ('k') | mojo/edk/system/node_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/node_controller.h
diff --git a/mojo/edk/system/node_controller.h b/mojo/edk/system/node_controller.h
index 2cdcd90253a200336ec8f1162ba7de52bf9af7ec..69185fd99d38370e37e34438ee16be78907feed0 100644
--- a/mojo/edk/system/node_controller.h
+++ b/mojo/edk/system/node_controller.h
@@ -85,6 +85,10 @@ class NodeController : public ports::NodeDelegate,
// handshake.
void ConnectToParent(ScopedPlatformHandle platform_handle);
+ // Connects this node to a peer node. On success, |port| will be merged with
+ // the corresponding port in the peer node.
+ void ConnectToPeer(ScopedPlatformHandle handle, const ports::PortRef& port);
+
// Sets a port's observer. If |observer| is null the port's current observer
// is removed.
void SetPortObserver(const ports::PortRef& port,
@@ -146,6 +150,10 @@ class NodeController : public ports::NodeDelegate,
const ProcessErrorCallback& process_error_callback);
void ConnectToParentOnIOThread(ScopedPlatformHandle platform_handle);
+ void ConnectToPeerOnIOThread(ScopedPlatformHandle handle,
+ ports::NodeName token,
+ ports::PortRef port);
+
scoped_refptr<NodeChannel> GetPeerChannel(const ports::NodeName& name);
scoped_refptr<NodeChannel> GetParentChannel();
scoped_refptr<NodeChannel> GetBrokerChannel();
@@ -206,6 +214,10 @@ class NodeController : public ports::NodeDelegate,
const ports::NodeName& source_node,
Channel::MessagePtr message) override;
#endif
+ void OnAcceptPeer(const ports::NodeName& from_node,
+ const ports::NodeName& token,
+ const ports::NodeName& peer_name,
+ const ports::PortName& port_name) override;
void OnChannelError(const ports::NodeName& from_node,
NodeChannel* channel) override;
#if defined(OS_MACOSX) && !defined(OS_IOS)
@@ -305,6 +317,11 @@ class NodeController : public ports::NodeDelegate,
// Channels to children during handshake.
NodeMap pending_children_;
+ using PeerNodeMap =
+ std::unordered_map<ports::NodeName,
+ std::pair<scoped_refptr<NodeChannel>, ports::PortRef>>;
+ PeerNodeMap pending_peers_;
+
// Indicates whether this object should delete itself on IO thread shutdown.
// Must only be accessed from the IO thread.
bool destroy_on_io_thread_shutdown_ = false;
« no previous file with comments | « mojo/edk/system/node_channel.cc ('k') | mojo/edk/system/node_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698