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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 989703002: Add support for backgrounding processes on the Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix nits, add error checking. Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <limits> 11 #include <limits>
(...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 // background thread. If the UI thread invokes this API just when it is 2239 // background thread. If the UI thread invokes this API just when it is
2240 // intercepted the stack is messed up on return from the interceptor 2240 // intercepted the stack is messed up on return from the interceptor
2241 // which causes random crashes in the browser process. Our hack for now 2241 // which causes random crashes in the browser process. Our hack for now
2242 // is to not invoke the SetPriorityClass API if the dll is loaded. 2242 // is to not invoke the SetPriorityClass API if the dll is loaded.
2243 if (GetModuleHandle(L"cbstext.dll")) 2243 if (GetModuleHandle(L"cbstext.dll"))
2244 return; 2244 return;
2245 #endif // OS_WIN 2245 #endif // OS_WIN
2246 2246
2247 #if defined(OS_WIN) 2247 #if defined(OS_WIN)
2248 // Same as below, but bound to an experiment (http://crbug.com/458594) 2248 // Same as below, but bound to an experiment (http://crbug.com/458594)
2249 // initially on Windows. Enabled by default in the asbence of field trials to 2249 // initially on Windows. Enabled by default in the absence of field trials to
2250 // get coverage on the perf waterfall. 2250 // get coverage on the perf waterfall.
2251 base::FieldTrial* trial = 2251 base::FieldTrial* trial =
2252 base::FieldTrialList::Find("BackgroundRendererProcesses"); 2252 base::FieldTrialList::Find("BackgroundRendererProcesses");
2253 if (!trial || trial->group_name() != "Disallow") 2253 if (!trial || trial->group_name() != "Disallow")
2254 child_process_launcher_->SetProcessBackgrounded(backgrounded); 2254 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2255 #elif defined(OS_MACOSX)
2256 // Same as below, but bound to an experiment (http://crbug.com/458594) .
2257 // Disabled by default (perf waterfall coverage will come through a new
2258 // telemetry benchmark).
2259 const std::string trial_group_name =
2260 base::FieldTrialList::FindFullName("BackgroundRendererProcesses");
2261 if (!trial_group_name.empty() && trial_group_name != "Disallow") {
Alexei Svitkine (slow) 2015/04/23 20:53:28 This pattern makes it impossible to have a Control
2262 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2263 }
2255 #else 2264 #else
2256 // Control the background state from the browser process, otherwise the task 2265 // Control the background state from the browser process, otherwise the task
2257 // telling the renderer to "unbackground" itself may be preempted by other 2266 // telling the renderer to "unbackground" itself may be preempted by other
2258 // tasks executing at lowered priority ahead of it or simply by not being 2267 // tasks executing at lowered priority ahead of it or simply by not being
2259 // swiftly scheduled by the OS per the low process priority 2268 // swiftly scheduled by the OS per the low process priority
2260 // (http://crbug.com/398103). 2269 // (http://crbug.com/398103).
2261 child_process_launcher_->SetProcessBackgrounded(backgrounded); 2270 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2262 #endif // OS_WIN 2271 #endif // OS_WIN
2263 2272
2264 // Notify the child process of background state. 2273 // Notify the child process of background state.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2480 if (worker_ref_count_ == 0) 2489 if (worker_ref_count_ == 0)
2481 Cleanup(); 2490 Cleanup();
2482 } 2491 }
2483 2492
2484 void RenderProcessHostImpl::GetAudioOutputControllers( 2493 void RenderProcessHostImpl::GetAudioOutputControllers(
2485 const GetAudioOutputControllersCallback& callback) const { 2494 const GetAudioOutputControllersCallback& callback) const {
2486 audio_renderer_host()->GetOutputControllers(callback); 2495 audio_renderer_host()->GetOutputControllers(callback);
2487 } 2496 }
2488 2497
2489 } // namespace content 2498 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/child_process_launcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698