OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <utility> // For std::pair. | 7 #include <utility> // For std::pair. |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 #elif defined(OS_POSIX) | 122 #elif defined(OS_POSIX) |
123 // We need to close the client end of the IPC channel | 123 // We need to close the client end of the IPC channel |
124 // to reliably detect child termination. | 124 // to reliably detect child termination. |
125 file_util::ScopedFD ipcfd_closer(&ipcfd); | 125 file_util::ScopedFD ipcfd_closer(&ipcfd); |
126 | 126 |
127 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 127 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
128 // On Linux, we need to add some extra file descriptors for crash handling. | 128 // On Linux, we need to add some extra file descriptors for crash handling. |
129 std::string process_type = | 129 std::string process_type = |
130 cmd_line->GetSwitchValueASCII(switches::kProcessType); | 130 cmd_line->GetSwitchValueASCII(switches::kProcessType); |
131 int crash_signal_fd = | 131 int crash_signal_fd = |
132 content::GetContentClient()->browser()->GetCrashSignalFD(process_type); | 132 content::GetContentClient()->browser()->GetCrashSignalFD(*cmd_line); |
133 if (use_zygote) { | 133 if (use_zygote) { |
134 base::GlobalDescriptors::Mapping mapping; | 134 base::GlobalDescriptors::Mapping mapping; |
135 mapping.push_back(std::pair<uint32_t, int>(kPrimaryIPCChannel, ipcfd)); | 135 mapping.push_back(std::pair<uint32_t, int>(kPrimaryIPCChannel, ipcfd)); |
136 if (crash_signal_fd >= 0) { | 136 if (crash_signal_fd >= 0) { |
137 mapping.push_back(std::pair<uint32_t, int>(kCrashDumpSignal, | 137 mapping.push_back(std::pair<uint32_t, int>(kCrashDumpSignal, |
138 crash_signal_fd)); | 138 crash_signal_fd)); |
139 } | 139 } |
140 handle = ZygoteHost::GetInstance()->ForkRequest(cmd_line->argv(), | 140 handle = ZygoteHost::GetInstance()->ForkRequest(cmd_line->argv(), |
141 mapping, | 141 mapping, |
142 process_type); | 142 process_type); |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 NewRunnableFunction( | 373 NewRunnableFunction( |
374 &ChildProcessLauncher::Context::SetProcessBackgrounded, | 374 &ChildProcessLauncher::Context::SetProcessBackgrounded, |
375 GetHandle(), background)); | 375 GetHandle(), background)); |
376 } | 376 } |
377 | 377 |
378 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 378 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
379 bool terminate_on_shutdown) { | 379 bool terminate_on_shutdown) { |
380 if (context_) | 380 if (context_) |
381 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 381 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
382 } | 382 } |
OLD | NEW |