Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index 68b50c70c6e1acbcdb54776df6cf335bf4d79410..ddd7a4b92bf1f739aefd6d1245bc542eaa0f597d 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -2207,17 +2207,27 @@ void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { |
return; |
#endif // OS_WIN |
+#if defined(OS_WIN) |
+ // Same as below, but bound to an experiment (http://crbug.com/458594) |
+ // initially on Windows. Enabled by default in the asbence of field trials to |
+ // get coverage on the perf waterfall. |
+ base::FieldTrial* trial = |
+ base::FieldTrialList::Find("BackgroundRendererProcesses"); |
+ if (!trial || (trial->group_name() != "Disallow" && |
+ trial->group_name() != "AllowBackgroundModeFromRenderer")) { |
+ child_process_launcher_->SetProcessBackgrounded(backgrounded); |
+ } |
+#else |
+ // Control the background state from the browser process, otherwise the task |
+ // telling the renderer to "unbackground" itself may be preempted by other |
+ // tasks executing at lowered priority ahead of it or simply by not being |
+ // swiftly scheduled by the OS per the low process priority |
+ // (http://crbug.com/398103). |
+ child_process_launcher_->SetProcessBackgrounded(backgrounded); |
+#endif // OS_WIN |
+ |
// Notify the child process of background state. |
Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); |
- |
-#if !defined(OS_WIN) |
- // Backgrounding may require elevated privileges not available to renderer |
- // processes, so control backgrounding from the process host. |
- |
- // Windows Vista+ has a fancy process backgrounding mode that can only be set |
- // from within the process. |
- child_process_launcher_->SetProcessBackgrounded(backgrounded); |
-#endif // !OS_WIN |
} |
void RenderProcessHostImpl::OnProcessLaunched() { |