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..d5e98e6b8ecc18c81fe4a544fb743259fb82028f 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) |
+ const std::string trial_group_name = |
+ 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 (trial_group_name != "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 |