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

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: Clean up field trial logic Created 5 years, 9 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
« base/process/process_mac.cc ('K') | « base/process/process_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_launcher.cc
diff --git a/content/browser/child_process_launcher.cc b/content/browser/child_process_launcher.cc
index 5a7be486f07814d5cb67fbfb65a039502363dc96..4ed97a4a7e30241e7748672944eaa65e4a8f8480 100644
--- a/content/browser/child_process_launcher.cc
+++ b/content/browser/child_process_launcher.cc
@@ -12,6 +12,7 @@
#include "base/files/scoped_file.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/synchronization/lock.h"
@@ -503,7 +504,19 @@ void ChildProcessLauncher::Context::Terminate() {
void ChildProcessLauncher::Context::SetProcessBackgroundedInternal(
base::Process process,
bool background) {
+#if defined(OS_MACOSX)
+ std::string trialGroupName =
gab 2015/03/12 15:50:09 nit: const
Alexei Svitkine (slow) 2015/03/12 15:57:07 hacker_style
shrike 2015/03/18 16:20:22 Done and done.
+ base::FieldTrialList::FindFullName("BackgroundMacRendererProcesses");
+ // Activate backgrounding when the user is part of the field trial, or
+ // there's no trial (i.e. a perf bot)
+ if (trialGroupName != "Off") {
+ 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
« base/process/process_mac.cc ('K') | « base/process/process_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698