Index: mojo/edk/system/remote_message_pipe_bootstrap.cc |
diff --git a/mojo/edk/system/remote_message_pipe_bootstrap.cc b/mojo/edk/system/remote_message_pipe_bootstrap.cc |
index 234216633f2fc074d39e29681fd4dec44f592cc1..671542f3595c72615a74b18919d0bcd9dbd181bc 100644 |
--- a/mojo/edk/system/remote_message_pipe_bootstrap.cc |
+++ b/mojo/edk/system/remote_message_pipe_bootstrap.cc |
@@ -31,17 +31,18 @@ |
void RemoteMessagePipeBootstrap::Create( |
NodeController* node_controller, |
ScopedPlatformHandle platform_handle, |
- const ports::PortRef& port) { |
+ const ports::PortRef& port, |
+ const base::Closure& callback) { |
if (node_controller->io_task_runner()->RunsTasksOnCurrentThread()) { |
// Owns itself. |
- new RemoteMessagePipeBootstrap( |
- node_controller, std::move(platform_handle), port); |
+ new RemoteMessagePipeBootstrap(node_controller, std::move(platform_handle), |
+ port, callback); |
} else { |
node_controller->io_task_runner()->PostTask( |
FROM_HERE, |
base::Bind(&RemoteMessagePipeBootstrap::Create, |
base::Unretained(node_controller), |
- base::Passed(&platform_handle), port)); |
+ base::Passed(&platform_handle), port, callback)); |
} |
} |
@@ -55,9 +56,11 @@ |
RemoteMessagePipeBootstrap::RemoteMessagePipeBootstrap( |
NodeController* node_controller, |
ScopedPlatformHandle platform_handle, |
- const ports::PortRef& port) |
+ const ports::PortRef& port, |
+ const base::Closure& callback) |
: node_controller_(node_controller), |
local_port_(port), |
+ callback_(callback), |
io_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
channel_(Channel::Create(this, std::move(platform_handle), |
io_task_runner_)) { |
@@ -116,14 +119,8 @@ |
} |
peer_info_received_ = true; |
- |
- // We need to choose one side to initiate the port merge. It doesn't matter |
- // who does it as long as they don't both try. Simple solution: pick the one |
- // with the "smaller" port name. |
- if (local_port_.name() < data->port_name) { |
- node_controller_->node()->MergePorts(local_port_, data->node_name, |
- data->port_name); |
- } |
+ node_controller_->ConnectToRemotePort( |
+ local_port_, data->node_name, data->port_name, callback_); |
// Send another ping to the other end to trigger shutdown. This may race with |
// the other end sending its own ping, but it doesn't matter. Whoever wins |