Chromium Code Reviews| 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 14006ce388f2c59fd6e83ec6256919e5f01b3bba..da046bec667241022458685a78a11970bc4e87cd 100644 |
| --- a/content/browser/renderer_host/render_process_host_impl.cc |
| +++ b/content/browser/renderer_host/render_process_host_impl.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. |
| @@ -2205,6 +2205,12 @@ void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { |
| if (backgrounded_ && audio_renderer_host_->HasActiveAudio()) |
| return; |
| + const base::CommandLine* command_line = |
| + base::CommandLine::ForCurrentProcess(); |
| + if (command_line->HasSwitch(switches::kDisableRendererBackgrounding)) { |
| + return; |
| + } |
|
gab
2015/06/01 19:34:20
nit: Avoid {} (I know you like putting it all the
shrike
2015/06/02 18:06:31
It feels wrong, but you are right. Fixed.
|
| + |
| #if defined(OS_WIN) |
| // The cbstext.dll loads as a global GetMessage hook in the browser process |
| // and intercepts/unintercepts the kernel32 API SetPriorityClass in a |
| @@ -2216,14 +2222,15 @@ 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. |
| +#if defined(OS_WIN) || defined(OS_MACOSX) |
| + // Same as below, but bound to an experiment (http://crbug.com/458594 on |
| + // Windows, http://crbug.com/398103 on the Mac). Enabled by default in the |
| + // absence of field trials to get coverage on the perf waterfall. |
| base::FieldTrial* trial = |
| base::FieldTrialList::Find("BackgroundRendererProcesses"); |
| - if (!trial || trial->group_name() != "Disallow") |
| + if (!trial || !StartsWithASCII(trial->group_name(), "Disallow", true)) { |
| 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 |