Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/child_process_launcher.h" | 5 #include "content/browser/child_process_launcher.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/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 141 #endif | 141 #endif |
| 142 | 142 |
| 143 #if defined(OS_ANDROID) | 143 #if defined(OS_ANDROID) |
| 144 // Android WebView runs in single process, ensure that we never get here | 144 // Android WebView runs in single process, ensure that we never get here |
| 145 // when running in single process mode. | 145 // when running in single process mode. |
| 146 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); | 146 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); |
| 147 | 147 |
| 148 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( | 148 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
| 149 *cmd_line, child_process_id, files_to_register.get()); | 149 *cmd_line, child_process_id, files_to_register.get()); |
| 150 | 150 |
| 151 GetContentClient()->browser()->AppendMappedFileCommandLineSwitches(cmd_line); | |
| 152 | |
| 151 StartChildProcess( | 153 StartChildProcess( |
| 152 cmd_line->argv(), child_process_id, files_to_register.Pass(), | 154 cmd_line->argv(), child_process_id, files_to_register.Pass(), |
| 153 base::Bind(&OnChildProcessStartedAndroid, callback, client_thread_id, | 155 base::Bind(&OnChildProcessStartedAndroid, callback, client_thread_id, |
| 154 begin_launch_time, base::Passed(&ipcfd))); | 156 begin_launch_time, base::Passed(&ipcfd))); |
| 155 | 157 |
| 156 #elif defined(OS_POSIX) | 158 #elif defined(OS_POSIX) |
| 157 // We need to close the client end of the IPC channel to reliably detect | 159 // We need to close the client end of the IPC channel to reliably detect |
| 158 // child termination. | 160 // child termination. |
| 159 | 161 |
| 160 #if !defined(OS_MACOSX) | 162 #if !defined(OS_MACOSX) |
| 161 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( | 163 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
| 162 *cmd_line, child_process_id, files_to_register.get()); | 164 *cmd_line, child_process_id, files_to_register.get()); |
| 165 | |
| 166 GetContentClient()->browser()->AppendMappedFileCommandLineSwitches(cmd_line); | |
|
rmcilroy
2015/06/05 13:24:51
nit - there is another call to GetAdditionalMapped
Erik Corry Chromium.org
2015/06/08 13:31:03
In the end I didn't do this becasue the command li
rmcilroy
2015/06/08 17:26:12
Ahh well, if it works I guess this is fine.
| |
| 167 | |
| 163 if (use_zygote) { | 168 if (use_zygote) { |
| 164 base::ProcessHandle handle = ZygoteHostImpl::GetInstance()->ForkRequest( | 169 base::ProcessHandle handle = ZygoteHostImpl::GetInstance()->ForkRequest( |
| 165 cmd_line->argv(), files_to_register.Pass(), process_type); | 170 cmd_line->argv(), files_to_register.Pass(), process_type); |
| 166 process = base::Process(handle); | 171 process = base::Process(handle); |
| 167 } else | 172 } else |
| 168 // Fall through to the normal posix case below when we're not zygoting. | 173 // Fall through to the normal posix case below when we're not zygoting. |
| 169 #endif // !defined(OS_MACOSX) | 174 #endif // !defined(OS_MACOSX) |
| 170 { | 175 { |
| 171 // Convert FD mapping to FileHandleMappingVector | 176 // Convert FD mapping to FileHandleMappingVector |
| 172 base::FileHandleMappingVector fds_to_map = | 177 base::FileHandleMappingVector fds_to_map = |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 493 } | 498 } |
| 494 | 499 |
| 495 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 500 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( |
| 496 Client* client) { | 501 Client* client) { |
| 497 Client* ret = client_; | 502 Client* ret = client_; |
| 498 client_ = client; | 503 client_ = client; |
| 499 return ret; | 504 return ret; |
| 500 } | 505 } |
| 501 | 506 |
| 502 } // namespace content | 507 } // namespace content |
| OLD | NEW |