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 |