OLD | NEW |
1 // Copyright (c) 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" |
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 |
272 process.SetProcessBackgrounded(background); | 279 process.SetProcessBackgrounded(background); |
| 280 #endif // defined(OS_MACOSX) |
273 #if defined(OS_ANDROID) | 281 #if defined(OS_ANDROID) |
274 SetChildProcessInForeground(process.Handle(), !background); | 282 SetChildProcessInForeground(process.Handle(), !background); |
275 #endif | 283 #endif |
276 } | 284 } |
277 | 285 |
278 } // anonymous namespace | 286 } // anonymous namespace |
279 | 287 |
280 ChildProcessLauncher::ChildProcessLauncher( | 288 ChildProcessLauncher::ChildProcessLauncher( |
281 SandboxedProcessLauncherDelegate* delegate, | 289 SandboxedProcessLauncherDelegate* delegate, |
282 base::CommandLine* cmd_line, | 290 base::CommandLine* cmd_line, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 } | 501 } |
494 | 502 |
495 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( | 503 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( |
496 Client* client) { | 504 Client* client) { |
497 Client* ret = client_; | 505 Client* ret = client_; |
498 client_ = client; | 506 client_ = client; |
499 return ret; | 507 return ret; |
500 } | 508 } |
501 | 509 |
502 } // namespace content | 510 } // namespace content |
OLD | NEW |