| OLD | NEW |
| 1 // Copyright 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" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } else | 262 } else |
| 263 #endif // !OS_MACOSX | 263 #endif // !OS_MACOSX |
| 264 base::EnsureProcessTerminated(process.Pass()); | 264 base::EnsureProcessTerminated(process.Pass()); |
| 265 #endif // OS_POSIX | 265 #endif // OS_POSIX |
| 266 #endif // defined(OS_ANDROID) | 266 #endif // defined(OS_ANDROID) |
| 267 } | 267 } |
| 268 | 268 |
| 269 void SetProcessBackgroundedOnLauncherThread(base::Process process, | 269 void SetProcessBackgroundedOnLauncherThread(base::Process process, |
| 270 bool background) { | 270 bool background) { |
| 271 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); | 271 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); |
| 272 #if defined(OS_MACOSX) | |
| 273 MachBroker* broker = MachBroker::GetInstance(); | |
| 274 mach_port_t task_port = broker->TaskForPid(process.Pid()); | |
| 275 if (task_port != TASK_NULL) { | |
| 276 process.SetProcessBackgrounded(task_port, background); | |
| 277 } | |
| 278 #else | |
| 279 process.SetProcessBackgrounded(background); | 272 process.SetProcessBackgrounded(background); |
| 280 #endif // defined(OS_MACOSX) | |
| 281 #if defined(OS_ANDROID) | 273 #if defined(OS_ANDROID) |
| 282 SetChildProcessInForeground(process.Handle(), !background); | 274 SetChildProcessInForeground(process.Handle(), !background); |
| 283 #endif | 275 #endif |
| 284 } | 276 } |
| 285 | 277 |
| 286 } // anonymous namespace | 278 } // anonymous namespace |
| 287 | 279 |
| 288 ChildProcessLauncher::ChildProcessLauncher( | 280 ChildProcessLauncher::ChildProcessLauncher( |
| 289 SandboxedProcessLauncherDelegate* delegate, | 281 SandboxedProcessLauncherDelegate* delegate, |
| 290 base::CommandLine* cmd_line, | 282 base::CommandLine* cmd_line, |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 } | 493 } |
| 502 | 494 |
| 503 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 495 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( |
| 504 Client* client) { | 496 Client* client) { |
| 505 Client* ret = client_; | 497 Client* ret = client_; |
| 506 client_ = client; | 498 client_ = client; |
| 507 return ret; | 499 return ret; |
| 508 } | 500 } |
| 509 | 501 |
| 510 } // namespace content | 502 } // namespace content |
| OLD | NEW |