summaryrefslogtreecommitdiffstats
path: root/mojo/edk/system/remote_message_pipe_bootstrap.cc
diff options
context:
space:
mode:
authorblundell <blundell@chromium.org>2016-02-09 02:26:54 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-09 10:27:56 +0000
commitc8588be061339ced9a34d3d7e3319daf7eee241d (patch)
treec51d3e41c3d4029ba97d47588867e1e9a2f085ae /mojo/edk/system/remote_message_pipe_bootstrap.cc
parent1f071893d22e2260b5ebc6c97a02626a9ca945fe (diff)
downloadchromium_src-c8588be061339ced9a34d3d7e3319daf7eee241d.zip
chromium_src-c8588be061339ced9a34d3d7e3319daf7eee241d.tar.gz
chromium_src-c8588be061339ced9a34d3d7e3319daf7eee241d.tar.bz2
Revert of [mojo-edk] Simplify multiprocess pipe bootstrap (patchset #7 id:140001 of https://codereview.chromium.org/1675603002/ )
Reason for revert: This patch broke several browsertests on Linux: PlatformAppBrowserTest.LoadAndLaunchAppChromeRunning, PlatformAppBrowserTest.LoadAndLaunchAppWithFile, PolicyMakeDefaultBrowserTest.MakeDefaultDisabled (e.g., https://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Tests%20%28dbg%29%281%29%2832%29&number=25685). I could repro the failures locally, and reverting this patch fixed them. Example failure: PlatformAppBrowserTest.LoadAndLaunchAppChromeRunning (run #1): [ RUN ] PlatformAppBrowserTest.LoadAndLaunchAppChromeRunning <snip> [26865:26901:0209/004101:FATAL:thread.cc(270)] Check failed: GetThreadWasQuitProperly(). #0 0x0000f7142d94 base::debug::StackTrace::StackTrace() #1 0x0000f71a998f logging::LogMessage::~LogMessage() #2 0x0000f72cc94f base::Thread::ThreadMain() #3 0x0000f72b487a base::(anonymous namespace)::ThreadFunc() #4 0x0000e749dd4c start_thread #5 0x0000e6a7cb8e clone Original issue's description: > [mojo-edk] Simplify multiprocess pipe bootstrap > > This introduces a new MergePort message at the Ports layer > for joining two independent port cycles which each have > an unused (i.e. unwritten, unread, unsent) receiving port. > > MergePort allows us to create a MessagePipeDispatcher which > is immediately usable but which will eventually be linked to > a MessagePipeDispatcher on another port cycle, potentially in > another process. > > The basic idea is to create a fully functional port pair but > only bind one port to an MPD. Do this on each end and > merge the dangling ports asynchronously. > > The simplification here allows a lot of code to be deleted > from NodeController, some of which is deleted in this CL. > > Future work will convert existing bootstrap sites back to > using synchronous bootstrap, including the token-based APIs. > > BUG=584764 > TBR=ben@chromium.org for null check in mash shell > > Committed: https://crrev.com/b3ea203171e07f5c7e476e94d210ec4ad53ce5b0 > Cr-Commit-Position: refs/heads/master@{#374322} TBR=amistry@chromium.org,darin@chormium.org,rockot@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=584764 Review URL: https://codereview.chromium.org/1678333003 Cr-Commit-Position: refs/heads/master@{#374346}
Diffstat (limited to 'mojo/edk/system/remote_message_pipe_bootstrap.cc')
-rw-r--r--mojo/edk/system/remote_message_pipe_bootstrap.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/mojo/edk/system/remote_message_pipe_bootstrap.cc b/mojo/edk/system/remote_message_pipe_bootstrap.cc
index 2342166..671542f3 100644
--- a/mojo/edk/system/remote_message_pipe_bootstrap.cc
+++ b/mojo/edk/system/remote_message_pipe_bootstrap.cc
@@ -31,17 +31,18 @@ struct BootstrapData {
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() {
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 @@ void RemoteMessagePipeBootstrap::OnChannelMessage(
}
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