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

Unified Diff: content/browser/child_process_launcher.cc

Issue 989703002: Add support for backgrounding processes on the Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on tot, rewrapped backgrounging in an experiment. Created 5 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/child_process_launcher.cc
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 28be72bb9c32eb853702adbdb0726379a3f9825c..aeb8fd3c9d52cc46eeaad95f2e9ce32d4f90d649 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -9,6 +9,7 @@
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/process/process.h"
#include "base/profiler/scoped_tracker.h"
@@ -19,6 +20,7 @@
#include "content/public/common/content_switches.h"
#include "content/public/common/result_codes.h"
#include "content/public/common/sandboxed_process_launcher_delegate.h"
+#include "content/shell/common/shell_switches.h"
Avi (use Gerrit) 2015/04/16 02:46:20 This is the wrong file; you mean content/public/co
shrike 2015/04/16 17:31:32 Hi Avi, (not sure how I didn't fire up the trybot
#if defined(OS_WIN)
#include "base/files/file_path.h"
@@ -269,7 +271,20 @@ void TerminateOnLauncherThread(bool zygote, base::Process process) {
void SetProcessBackgroundedOnLauncherThread(base::Process process,
bool background) {
DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
+#if defined(OS_MACOSX)
+ const std::string trial_group_name =
+ base::FieldTrialList::FindFullName("BackgroundMacRendererProcesses");
gab 2015/04/16 13:18:13 As mentioned offline, I think we should use the sa
shrike 2015/04/21 20:55:48 Done.
+ bool allow_background_renderers =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
gab 2015/04/16 18:42:42 Don't need a command-line switch either, it comes
shrike 2015/04/21 20:55:48 Done.
+ switches::kBackgroundMacRendererProcesses);
+ if (allow_background_renderers || trial_group_name == "Allow") {
+ MachBroker* broker = MachBroker::GetInstance();
+ process.SetProcessBackgrounded(broker->TaskForPid(process.Pid()),
+ background);
+ }
+#else
process.SetProcessBackgrounded(background);
+#endif // defined(OS_MACOSX)
#if defined(OS_ANDROID)
SetChildProcessInForeground(process.Handle(), !background);
#endif

Powered by Google App Engine
This is Rietveld 408576698