OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/child_process_launcher.h" | 5 #include "chrome/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/lock.h" | 10 #include "base/lock.h" |
(...skipping 155 matching lines...) Loading... |
166 #endif // defined(OS_LINUX) | 166 #endif // defined(OS_LINUX) |
167 | 167 |
168 bool launched = false; | 168 bool launched = false; |
169 #if defined(OS_MACOSX) | 169 #if defined(OS_MACOSX) |
170 // It is possible for the child process to die immediately after | 170 // It is possible for the child process to die immediately after |
171 // launching. To prevent leaking MachBroker map entries in this case, | 171 // launching. To prevent leaking MachBroker map entries in this case, |
172 // lock around all of LaunchApp(). If the child dies, the death | 172 // lock around all of LaunchApp(). If the child dies, the death |
173 // notification will be processed by the MachBroker after the call to | 173 // notification will be processed by the MachBroker after the call to |
174 // AddPlaceholderForPid(), enabling proper cleanup. | 174 // AddPlaceholderForPid(), enabling proper cleanup. |
175 { // begin scope for AutoLock | 175 { // begin scope for AutoLock |
176 MachBroker* broker = MachBroker::instance(); | 176 MachBroker* broker = MachBroker::GetInstance(); |
177 AutoLock lock(broker->GetLock()); | 177 AutoLock lock(broker->GetLock()); |
178 | 178 |
179 // This call to |PrepareForFork()| will start the MachBroker listener | 179 // This call to |PrepareForFork()| will start the MachBroker listener |
180 // thread, if it is not already running. Therefore the browser process | 180 // thread, if it is not already running. Therefore the browser process |
181 // will be listening for Mach IPC before LaunchApp() is called. | 181 // will be listening for Mach IPC before LaunchApp() is called. |
182 broker->PrepareForFork(); | 182 broker->PrepareForFork(); |
183 #endif | 183 #endif |
184 // Actually launch the app. | 184 // Actually launch the app. |
185 launched = base::LaunchApp(cmd_line->argv(), env, fds_to_map, | 185 launched = base::LaunchApp(cmd_line->argv(), env, fds_to_map, |
186 /* wait= */false, &handle); | 186 /* wait= */false, &handle); |
(...skipping 145 matching lines...) Loading... |
332 if (child_exited) | 332 if (child_exited) |
333 context_->process_.Close(); | 333 context_->process_.Close(); |
334 | 334 |
335 return did_crash; | 335 return did_crash; |
336 } | 336 } |
337 | 337 |
338 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { | 338 void ChildProcessLauncher::SetProcessBackgrounded(bool background) { |
339 DCHECK(!context_->starting_); | 339 DCHECK(!context_->starting_); |
340 context_->process_.SetProcessBackgrounded(background); | 340 context_->process_.SetProcessBackgrounded(background); |
341 } | 341 } |
OLD | NEW |