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 <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 cmd_line->argv(), child_process_id, std::move(files_to_register), regions, | 252 cmd_line->argv(), child_process_id, std::move(files_to_register), regions, |
253 base::Bind(&OnChildProcessStartedAndroid, callback, client_thread_id, | 253 base::Bind(&OnChildProcessStartedAndroid, callback, client_thread_id, |
254 begin_launch_time, base::Passed(&ipcfd), | 254 begin_launch_time, base::Passed(&ipcfd), |
255 base::Passed(&mojo_fd))); | 255 base::Passed(&mojo_fd))); |
256 | 256 |
257 #elif defined(OS_POSIX) | 257 #elif defined(OS_POSIX) |
258 // We need to close the client end of the IPC channel to reliably detect | 258 // We need to close the client end of the IPC channel to reliably detect |
259 // child termination. | 259 // child termination. |
260 | 260 |
261 #if !defined(OS_MACOSX) | 261 #if !defined(OS_MACOSX) |
262 ZygoteHandle* zygote_handle = delegate->GetZygote(); | 262 ZygoteHandle* zygote_handle = |
| 263 !base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoZygote) |
| 264 ? delegate->GetZygote() |
| 265 : nullptr; |
263 // If |zygote_handle| is null, a zygote should not be used. | 266 // If |zygote_handle| is null, a zygote should not be used. |
264 if (zygote_handle) { | 267 if (zygote_handle) { |
265 // This code runs on the PROCESS_LAUNCHER thread so race conditions are not | 268 // This code runs on the PROCESS_LAUNCHER thread so race conditions are not |
266 // an issue with the lazy initialization. | 269 // an issue with the lazy initialization. |
267 if (*zygote_handle == nullptr) { | 270 if (*zygote_handle == nullptr) { |
268 *zygote_handle = CreateZygote(); | 271 *zygote_handle = CreateZygote(); |
269 } | 272 } |
270 zygote = *zygote_handle; | 273 zygote = *zygote_handle; |
271 base::ProcessHandle handle = zygote->ForkRequest( | 274 base::ProcessHandle handle = zygote->ForkRequest( |
272 cmd_line->argv(), std::move(files_to_register), process_type); | 275 cmd_line->argv(), std::move(files_to_register), process_type); |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 } | 621 } |
619 | 622 |
620 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 623 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( |
621 Client* client) { | 624 Client* client) { |
622 Client* ret = client_; | 625 Client* ret = client_; |
623 client_ = client; | 626 client_ = client; |
624 return ret; | 627 return ret; |
625 } | 628 } |
626 | 629 |
627 } // namespace content | 630 } // namespace content |
OLD | NEW |