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

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

Issue 1675603002: [mojo-edk] Simplify multiprocess pipe bootstrap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: mojo/edk/system/node_controller.cc
diff --git a/mojo/edk/system/node_controller.cc b/mojo/edk/system/node_controller.cc
index b8bc4c61b822eec293ed36953bb6d2033e6b2ae6..b0eeabe5d5cd60bed0b3d2461f652db0d8067976 100644
--- a/mojo/edk/system/node_controller.cc
+++ b/mojo/edk/system/node_controller.cc
@@ -105,10 +105,6 @@ NodeController::ReservedPort::ReservedPort() {}
NodeController::ReservedPort::~ReservedPort() {}
-NodeController::PendingRemotePortConnection::PendingRemotePortConnection() {}
-
-NodeController::PendingRemotePortConnection::~PendingRemotePortConnection() {}
-
NodeController::~NodeController() {}
NodeController::NodeController(Core* core)
@@ -201,33 +197,6 @@ void NodeController::ConnectToParentPort(const ports::PortRef& local_port,
base::Unretained(this), local_port, token, callback));
}
-void NodeController::ConnectToRemotePort(
- const ports::PortRef& local_port,
- const ports::NodeName& remote_node_name,
- const ports::PortName& remote_port_name,
- const base::Closure& callback) {
- if (remote_node_name == name_) {
- // It's possible that two different code paths on the node are trying to
- // bootstrap ports to each other (e.g. in Chrome single-process mode)
- // without being aware of the fact. In this case we can initialize the port
- // immediately (which can fail silently if it's already been initialized by
- // the request on the other side), and invoke |callback|.
- node_->InitializePort(local_port, name_, remote_port_name);
- callback.Run();
- return;
- }
-
- PendingRemotePortConnection connection;
- connection.local_port = local_port;
- connection.remote_node_name = remote_node_name;
- connection.remote_port_name = remote_port_name;
- connection.callback = callback;
- io_task_runner_->PostTask(
- FROM_HERE,
- base::Bind(&NodeController::ConnectToRemotePortOnIOThread,
- base::Unretained(this), connection));
-}
-
void NodeController::RequestShutdown(const base::Closure& callback) {
{
base::AutoLock lock(shutdown_lock_);
@@ -298,25 +267,6 @@ void NodeController::RequestParentPortConnectionOnIOThread(
parent->RequestPortConnection(local_port.name(), token);
}
-void NodeController::ConnectToRemotePortOnIOThread(
- const PendingRemotePortConnection& connection) {
- scoped_refptr<NodeChannel> peer = GetPeerChannel(connection.remote_node_name);
- if (peer) {
- // It's safe to initialize the port since we already have a channel to its
- // peer. No need to actually send them a message.
- int rv = node_->InitializePort(connection.local_port,
- connection.remote_node_name,
- connection.remote_port_name);
- DCHECK_EQ(rv, ports::OK);
- connection.callback.Run();
- return;
- }
-
- // Save this for later. We'll initialize the port once this peer is added.
- pending_remote_port_connections_[connection.remote_node_name].push_back(
- connection);
-}
-
scoped_refptr<NodeChannel> NodeController::GetPeerChannel(
const ports::NodeName& name) {
base::AutoLock lock(peers_lock_);
@@ -387,19 +337,6 @@ void NodeController::AddPeer(const ports::NodeName& name,
channel->PortsMessage(std::move(pending_messages.front()));
pending_messages.pop();
}
-
- // Complete any pending port connections to this peer.
- auto connections_it = pending_remote_port_connections_.find(name);
- if (connections_it != pending_remote_port_connections_.end()) {
- for (const auto& connection : connections_it->second) {
- int rv = node_->InitializePort(connection.local_port,
- connection.remote_node_name,
- connection.remote_port_name);
- DCHECK_EQ(rv, ports::OK);
- connection.callback.Run();
- }
- pending_remote_port_connections_.erase(connections_it);
- }
}
void NodeController::DropPeer(const ports::NodeName& name) {

Powered by Google App Engine
This is Rietveld 408576698