Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: content/browser/child_process_launcher.cc

Issue 2454073003: Allow backgrounding processes on Mac (Closed)
Patch Set: Remove unnecessary forward declare Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 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 <memory> 7 #include <memory>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 20 matching lines...) Expand all
31 #include "mojo/edk/embedder/scoped_platform_handle.h" 31 #include "mojo/edk/embedder/scoped_platform_handle.h"
32 32
33 #if defined(OS_WIN) 33 #if defined(OS_WIN)
34 #include "base/files/file_path.h" 34 #include "base/files/file_path.h"
35 #include "base/win/scoped_handle.h" 35 #include "base/win/scoped_handle.h"
36 #include "base/win/win_util.h" 36 #include "base/win/win_util.h"
37 #include "content/common/sandbox_win.h" 37 #include "content/common/sandbox_win.h"
38 #include "content/public/common/sandbox_init.h" 38 #include "content/public/common/sandbox_init.h"
39 #include "sandbox/win/src/sandbox_types.h" 39 #include "sandbox/win/src/sandbox_types.h"
40 #elif defined(OS_MACOSX) 40 #elif defined(OS_MACOSX)
41 #include "base/feature_list.h"
41 #include "content/browser/bootstrap_sandbox_manager_mac.h" 42 #include "content/browser/bootstrap_sandbox_manager_mac.h"
42 #include "content/browser/mach_broker_mac.h" 43 #include "content/browser/mach_broker_mac.h"
44 #include "content/public/common/content_features.h"
43 #include "sandbox/mac/bootstrap_sandbox.h" 45 #include "sandbox/mac/bootstrap_sandbox.h"
44 #include "sandbox/mac/pre_exec_delegate.h" 46 #include "sandbox/mac/pre_exec_delegate.h"
45 #elif defined(OS_ANDROID) 47 #elif defined(OS_ANDROID)
46 #include "base/android/jni_android.h" 48 #include "base/android/jni_android.h"
47 #include "content/browser/android/child_process_launcher_android.h" 49 #include "content/browser/android/child_process_launcher_android.h"
48 #elif defined(OS_POSIX) 50 #elif defined(OS_POSIX)
49 #include "base/memory/singleton.h" 51 #include "base/memory/singleton.h"
50 #include "content/browser/renderer_host/render_sandbox_host_linux.h" 52 #include "content/browser/renderer_host/render_sandbox_host_linux.h"
51 #include "content/browser/zygote_host/zygote_communication_linux.h" 53 #include "content/browser/zygote_host/zygote_communication_linux.h"
52 #include "content/browser/zygote_host/zygote_host_impl_linux.h" 54 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 #endif // !OS_MACOSX 380 #endif // !OS_MACOSX
379 base::EnsureProcessTerminated(std::move(process)); 381 base::EnsureProcessTerminated(std::move(process));
380 #endif // OS_POSIX 382 #endif // OS_POSIX
381 #endif // defined(OS_ANDROID) 383 #endif // defined(OS_ANDROID)
382 } 384 }
383 385
384 void SetProcessBackgroundedOnLauncherThread(base::Process process, 386 void SetProcessBackgroundedOnLauncherThread(base::Process process,
385 bool background) { 387 bool background) {
386 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER); 388 DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
387 if (process.CanBackgroundProcesses()) { 389 if (process.CanBackgroundProcesses()) {
390 #if defined(OS_MACOSX)
391 if (base::FeatureList::IsEnabled(features::kMacBackgroundInactiveTabs))
shrike 2016/10/31 17:26:05 Is this the only place you need to check for the e
lgrey 2016/10/31 19:22:02 Moved to CanBackgroundProcesses and moved the feat
392 process.SetProcessBackgrounded(MachBroker::GetInstance(), background);
393 #else
388 process.SetProcessBackgrounded(background); 394 process.SetProcessBackgrounded(background);
395 #endif // defined(OS_MACOSX)
389 } 396 }
390 #if defined(OS_ANDROID) 397 #if defined(OS_ANDROID)
391 SetChildProcessInForeground(process.Handle(), !background); 398 SetChildProcessInForeground(process.Handle(), !background);
392 #endif 399 #endif
393 } 400 }
394 401
395 } // namespace 402 } // namespace
396 403
397 ChildProcessLauncher::ChildProcessLauncher( 404 ChildProcessLauncher::ChildProcessLauncher(
398 SandboxedProcessLauncherDelegate* delegate, 405 SandboxedProcessLauncherDelegate* delegate,
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 } 629 }
623 630
624 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest( 631 ChildProcessLauncher::Client* ChildProcessLauncher::ReplaceClientForTest(
625 Client* client) { 632 Client* client) {
626 Client* ret = client_; 633 Client* ret = client_;
627 client_ = client; 634 client_ = client;
628 return ret; 635 return ret;
629 } 636 }
630 637
631 } // namespace content 638 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698