OLD | NEW |
1 // Copyright (c) 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 <utility> // For std::pair. | 7 #include <utility> // For std::pair. |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/files/scoped_file.h" | 12 #include "base/files/scoped_file.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/metrics/field_trial.h" |
15 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
16 #include "base/process/process.h" | 17 #include "base/process/process.h" |
17 #include "base/synchronization/lock.h" | 18 #include "base/synchronization/lock.h" |
18 #include "base/threading/thread.h" | 19 #include "base/threading/thread.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
21 #include "content/public/common/content_descriptors.h" | 22 #include "content/public/common/content_descriptors.h" |
22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
23 #include "content/public/common/result_codes.h" | 24 #include "content/public/common/result_codes.h" |
24 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 25 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 497 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
497 zygote_, | 498 zygote_, |
498 #endif | 499 #endif |
499 base::Passed(&process_))); | 500 base::Passed(&process_))); |
500 } | 501 } |
501 | 502 |
502 // static | 503 // static |
503 void ChildProcessLauncher::Context::SetProcessBackgroundedInternal( | 504 void ChildProcessLauncher::Context::SetProcessBackgroundedInternal( |
504 base::Process process, | 505 base::Process process, |
505 bool background) { | 506 bool background) { |
| 507 #if defined(OS_MACOSX) |
| 508 MachBroker* broker = MachBroker::GetInstance(); |
| 509 process.SetProcessBackgrounded(broker->TaskForPid(process.Pid()), background); |
| 510 #else |
506 process.SetProcessBackgrounded(background); | 511 process.SetProcessBackgrounded(background); |
| 512 #endif // defined(OS_MACOSX) |
507 #if defined(OS_ANDROID) | 513 #if defined(OS_ANDROID) |
508 SetChildProcessInForeground(process.Handle(), !background); | 514 SetChildProcessInForeground(process.Handle(), !background); |
509 #endif | 515 #endif |
510 } | 516 } |
511 | 517 |
512 // static | 518 // static |
513 void ChildProcessLauncher::Context::TerminateInternal( | 519 void ChildProcessLauncher::Context::TerminateInternal( |
514 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 520 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
515 bool zygote, | 521 bool zygote, |
516 #endif | 522 #endif |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 context_->SetProcessBackgrounded(background); | 601 context_->SetProcessBackgrounded(background); |
596 } | 602 } |
597 | 603 |
598 void ChildProcessLauncher::SetTerminateChildOnShutdown( | 604 void ChildProcessLauncher::SetTerminateChildOnShutdown( |
599 bool terminate_on_shutdown) { | 605 bool terminate_on_shutdown) { |
600 if (context_.get()) | 606 if (context_.get()) |
601 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); | 607 context_->set_terminate_child_on_shutdown(terminate_on_shutdown); |
602 } | 608 } |
603 | 609 |
604 } // namespace content | 610 } // namespace content |
OLD | NEW |