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

Unified Diff: mojo/edk/system/node_channel.cc

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.h ('k') | mojo/edk/system/node_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/edk/system/node_channel.cc
diff --git a/mojo/edk/system/node_channel.cc b/mojo/edk/system/node_channel.cc
index 114e2863560b88c443049dbb1de8764c3e6858ef..da9e0dbf25c3bcd53413b119e566e11e28365d0c 100644
--- a/mojo/edk/system/node_channel.cc
+++ b/mojo/edk/system/node_channel.cc
@@ -47,6 +47,7 @@ enum class MessageType : uint32_t {
#if defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS))
PORTS_MESSAGE_FROM_RELAY,
#endif
+ ACCEPT_PEER,
};
struct Header {
@@ -67,6 +68,12 @@ struct AcceptParentData {
ports::NodeName child_name;
};
+struct AcceptPeerData {
+ ports::NodeName token;
+ ports::NodeName peer_name;
+ ports::PortName port_name;
+};
+
// This message may include a process handle on plaforms that require it.
struct AddBrokerClientData {
ports::NodeName client_name;
@@ -282,6 +289,18 @@ void NodeChannel::AcceptParent(const ports::NodeName& token,
WriteChannelMessage(std::move(message));
}
+void NodeChannel::AcceptPeer(const ports::NodeName& sender_name,
+ const ports::NodeName& token,
+ const ports::PortName& port_name) {
+ AcceptPeerData* data;
+ Channel::MessagePtr message =
+ CreateMessage(MessageType::ACCEPT_PEER, sizeof(AcceptPeerData), 0, &data);
+ data->token = token;
+ data->peer_name = sender_name;
+ data->port_name = port_name;
+ WriteChannelMessage(std::move(message));
+}
+
void NodeChannel::AddBrokerClient(const ports::NodeName& client_name,
base::ProcessHandle process_handle) {
AddBrokerClientData* data;
@@ -728,6 +747,16 @@ void NodeChannel::OnChannelMessage(const void* payload,
#endif // defined(OS_WIN) || (defined(OS_MACOSX) && !defined(OS_IOS))
+ case MessageType::ACCEPT_PEER: {
+ const AcceptPeerData* data;
+ if (GetMessagePayload(payload, payload_size, &data)) {
+ delegate_->OnAcceptPeer(remote_node_name_, data->token, data->peer_name,
+ data->port_name);
+ return;
+ }
+ break;
+ }
+
default:
break;
}
« no previous file with comments | « mojo/edk/system/node_channel.h ('k') | mojo/edk/system/node_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698