Chromium Code Reviews| Index: mojo/shell/child_process_host.cc |
| diff --git a/mojo/shell/child_process_host.cc b/mojo/shell/child_process_host.cc |
| index 9d955e22e0556d2cc5877b7efec0d399a0cb7387..d89bb7b8a6aded4b1856c790b06134757f5532f7 100644 |
| --- a/mojo/shell/child_process_host.cc |
| +++ b/mojo/shell/child_process_host.cc |
| @@ -13,6 +13,8 @@ |
| #include "base/message_loop/message_loop.h" |
| #include "base/process/kill.h" |
| #include "base/process/launch.h" |
| +#include "base/stl_util.h" |
| +#include "base/strings/string_split.h" |
| #include "base/task_runner.h" |
| #include "base/task_runner_util.h" |
| #include "mojo/edk/embedder/embedder.h" |
| @@ -24,8 +26,8 @@ |
| namespace mojo { |
| namespace shell { |
| -ChildProcessHost::ChildProcessHost(Context* context) |
| - : context_(context), channel_info_(nullptr) { |
| +ChildProcessHost::ChildProcessHost(Context* context, const std::string& name) |
| + : context_(context), name_(name), channel_info_(nullptr) { |
| platform_channel_ = platform_channel_pair_.PassServerHandle(); |
| CHECK(platform_channel_.is_valid()); |
| } |
| @@ -102,7 +104,16 @@ bool ChildProcessHost::DoLaunch() { |
| base::CommandLine child_command_line(parent_command_line->GetProgram()); |
| child_command_line.CopySwitchesFrom(*parent_command_line, kForwardSwitches, |
| arraysize(kForwardSwitches)); |
| + child_command_line.AppendSwitchASCII(switches::kApp, name_); |
|
sky
2015/04/23 21:48:54
Should you only do this if name_ is not empty?
jam
2015/04/23 22:18:44
I don't expect name_ to be empty. i added a dcheck
|
| child_command_line.AppendSwitch(switches::kChildProcess); |
| + if (parent_command_line->HasSwitch(switches::kWaitForDebugger)) { |
| + std::vector<std::string> apps_to_debug; |
| + base::SplitString( |
| + parent_command_line->GetSwitchValueASCII(switches::kWaitForDebugger), |
| + ',', &apps_to_debug); |
| + if (apps_to_debug.empty() || ContainsValue(apps_to_debug, name_)) |
| + child_command_line.AppendSwitch(switches::kWaitForDebugger); |
| + } |
| embedder::HandlePassingInformation handle_passing_info; |
| platform_channel_pair_.PrepareToPassClientHandleToChildProcess( |