| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "mojo/runner/child_process_host.h" | 5 #include "mojo/runner/child_process_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 if (!child_process_.IsValid()) { | 97 if (!child_process_.IsValid()) { |
| 98 LOG(ERROR) << "Failed to start child process"; | 98 LOG(ERROR) << "Failed to start child process"; |
| 99 AppCompleted(MOJO_RESULT_UNKNOWN); | 99 AppCompleted(MOJO_RESULT_UNKNOWN); |
| 100 } | 100 } |
| 101 } | 101 } |
| 102 | 102 |
| 103 void ChildProcessHost::DoLaunch() { | 103 void ChildProcessHost::DoLaunch() { |
| 104 const base::CommandLine* parent_command_line = | 104 const base::CommandLine* parent_command_line = |
| 105 base::CommandLine::ForCurrentProcess(); | 105 base::CommandLine::ForCurrentProcess(); |
| 106 base::CommandLine child_command_line(parent_command_line->GetProgram()); | 106 base::FilePath target_path = parent_command_line->GetProgram(); |
| 107 if (!app_path_.MatchesExtension(FILE_PATH_LITERAL(".mojo"))) |
| 108 target_path = app_path_; |
| 109 |
| 110 base::CommandLine child_command_line(target_path); |
| 107 child_command_line.AppendArguments(*parent_command_line, false); | 111 child_command_line.AppendArguments(*parent_command_line, false); |
| 108 child_command_line.AppendSwitchPath(switches::kChildProcess, app_path_); | 112 |
| 113 if (target_path != app_path_) |
| 114 child_command_line.AppendSwitchPath(switches::kChildProcess, app_path_); |
| 109 | 115 |
| 110 if (start_sandboxed_) | 116 if (start_sandboxed_) |
| 111 child_command_line.AppendSwitch(switches::kEnableSandbox); | 117 child_command_line.AppendSwitch(switches::kEnableSandbox); |
| 112 | 118 |
| 113 embedder::HandlePassingInformation handle_passing_info; | 119 embedder::HandlePassingInformation handle_passing_info; |
| 114 platform_channel_pair_.PrepareToPassClientHandleToChildProcess( | 120 platform_channel_pair_.PrepareToPassClientHandleToChildProcess( |
| 115 &child_command_line, &handle_passing_info); | 121 &child_command_line, &handle_passing_info); |
| 116 | 122 |
| 117 base::LaunchOptions options; | 123 base::LaunchOptions options; |
| 118 #if defined(OS_WIN) | 124 #if defined(OS_WIN) |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) { | 159 void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) { |
| 154 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; | 160 DVLOG(2) << "AppChildProcessHost::DidCreateChannel()"; |
| 155 | 161 |
| 156 DCHECK(channel_info || | 162 DCHECK(channel_info || |
| 157 base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")); | 163 base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")); |
| 158 channel_info_ = channel_info; | 164 channel_info_ = channel_info; |
| 159 } | 165 } |
| 160 | 166 |
| 161 } // namespace runner | 167 } // namespace runner |
| 162 } // namespace mojo | 168 } // namespace mojo |
| OLD | NEW |