OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 #endif | 142 #endif |
143 | 143 |
144 #if defined(OS_ANDROID) | 144 #if defined(OS_ANDROID) |
145 // Android WebView runs in single process, ensure that we never get here | 145 // Android WebView runs in single process, ensure that we never get here |
146 // when running in single process mode. | 146 // when running in single process mode. |
147 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); | 147 CHECK(!cmd_line->HasSwitch(switches::kSingleProcess)); |
148 std::map<int, base::MemoryMappedFile::Region> regions; | 148 std::map<int, base::MemoryMappedFile::Region> regions; |
149 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( | 149 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
150 *cmd_line, child_process_id, files_to_register.get()); | 150 *cmd_line, child_process_id, files_to_register.get()); |
151 | 151 |
| 152 GetContentClient()->browser()->AppendMappedFileCommandLineSwitches(cmd_line); |
| 153 |
152 StartChildProcess( | 154 StartChildProcess( |
153 cmd_line->argv(), child_process_id, files_to_register.Pass(), regions, | 155 cmd_line->argv(), child_process_id, files_to_register.Pass(), regions, |
154 base::Bind(&OnChildProcessStartedAndroid, callback, client_thread_id, | 156 base::Bind(&OnChildProcessStartedAndroid, callback, client_thread_id, |
155 begin_launch_time, base::Passed(&ipcfd))); | 157 begin_launch_time, base::Passed(&ipcfd))); |
156 | 158 |
157 #elif defined(OS_POSIX) | 159 #elif defined(OS_POSIX) |
158 // We need to close the client end of the IPC channel to reliably detect | 160 // We need to close the client end of the IPC channel to reliably detect |
159 // child termination. | 161 // child termination. |
160 | 162 |
161 #if !defined(OS_MACOSX) | 163 #if !defined(OS_MACOSX) |
162 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( | 164 GetContentClient()->browser()->GetAdditionalMappedFilesForChildProcess( |
163 *cmd_line, child_process_id, files_to_register.get()); | 165 *cmd_line, child_process_id, files_to_register.get()); |
| 166 |
| 167 GetContentClient()->browser()->AppendMappedFileCommandLineSwitches(cmd_line); |
| 168 |
164 if (use_zygote) { | 169 if (use_zygote) { |
165 base::ProcessHandle handle = ZygoteHostImpl::GetInstance()->ForkRequest( | 170 base::ProcessHandle handle = ZygoteHostImpl::GetInstance()->ForkRequest( |
166 cmd_line->argv(), files_to_register.Pass(), process_type); | 171 cmd_line->argv(), files_to_register.Pass(), process_type); |
167 process = base::Process(handle); | 172 process = base::Process(handle); |
168 } else | 173 } else |
169 // Fall through to the normal posix case below when we're not zygoting. | 174 // Fall through to the normal posix case below when we're not zygoting. |
170 #endif // !defined(OS_MACOSX) | 175 #endif // !defined(OS_MACOSX) |
171 { | 176 { |
172 // Convert FD mapping to FileHandleMappingVector | 177 // Convert FD mapping to FileHandleMappingVector |
173 base::FileHandleMappingVector fds_to_map = | 178 base::FileHandleMappingVector fds_to_map = |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 } | 510 } |
506 | 511 |
507 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 512 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( |
508 Client* client) { | 513 Client* client) { |
509 Client* ret = client_; | 514 Client* ret = client_; |
510 client_ = client; | 515 client_ = client; |
511 return ret; | 516 return ret; |
512 } | 517 } |
513 | 518 |
514 } // namespace content | 519 } // namespace content |
OLD | NEW |