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

Unified Diff: shell/child_process_host.cc

Issue 1143993004: Revert "Revert "Make shell child processes slaves."" (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « shell/child_process_host.h ('k') | shell/child_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: shell/child_process_host.cc
diff --git a/shell/child_process_host.cc b/shell/child_process_host.cc
index 0a027ae146ae3fb59b7ea4f01477f76f5740fe0c..647f8fdb2376698e99db0a05a66076e5c53df22c 100644
--- a/shell/child_process_host.cc
+++ b/shell/child_process_host.cc
@@ -35,9 +35,15 @@ ChildProcessHost::~ChildProcessHost() {
void ChildProcessHost::Start() {
DCHECK(!child_process_.IsValid());
+ // TODO(vtl): Add something for |slave_info|.
+ mojo::embedder::ScopedPlatformHandle platform_handle_for_channel;
+ std::string child_connection_id;
+ mojo::embedder::ConnectToSlave(
+ nullptr, platform_channel_pair_.PassServerHandle(),
+ &platform_handle_for_channel, &child_connection_id);
+
mojo::ScopedMessagePipeHandle handle(mojo::embedder::CreateChannel(
- platform_channel_pair_.PassServerHandle(),
- context_->task_runners()->io_runner(),
+ platform_handle_for_channel.Pass(), context_->task_runners()->io_runner(),
base::Bind(&ChildProcessHost::DidCreateChannel, base::Unretained(this)),
base::MessageLoop::current()->message_loop_proxy()));
@@ -46,7 +52,8 @@ void ChildProcessHost::Start() {
CHECK(base::PostTaskAndReplyWithResult(
context_->task_runners()->blocking_pool(), FROM_HERE,
- base::Bind(&ChildProcessHost::DoLaunch, base::Unretained(this)),
+ base::Bind(&ChildProcessHost::DoLaunch, base::Unretained(this),
+ child_connection_id),
base::Bind(&ChildProcessHost::DidStart, base::Unretained(this))));
}
@@ -96,7 +103,7 @@ void ChildProcessHost::DidCreateChannel(
channel_info_ = channel_info;
}
-bool ChildProcessHost::DoLaunch() {
+bool ChildProcessHost::DoLaunch(const std::string& child_connection_id) {
static const char* kForwardSwitches[] = {
switches::kTraceToConsole, switches::kV, switches::kVModule,
};
@@ -105,7 +112,8 @@ bool ChildProcessHost::DoLaunch() {
child_command_line.CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(),
kForwardSwitches,
arraysize(kForwardSwitches));
- child_command_line.AppendSwitch(switches::kChildProcess);
+ child_command_line.AppendSwitchASCII(switches::kChildConnectionId,
+ child_connection_id);
mojo::embedder::HandlePassingInformation handle_passing_info;
platform_channel_pair_.PrepareToPassClientHandleToChildProcess(
« no previous file with comments | « shell/child_process_host.h ('k') | shell/child_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698