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

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: Change string compare to be case sensitive. Created 5 years, 7 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
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 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2214 // The cbstext.dll loads as a global GetMessage hook in the browser process 2214 // The cbstext.dll loads as a global GetMessage hook in the browser process
2215 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a 2215 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a
2216 // background thread. If the UI thread invokes this API just when it is 2216 // background thread. If the UI thread invokes this API just when it is
2217 // intercepted the stack is messed up on return from the interceptor 2217 // intercepted the stack is messed up on return from the interceptor
2218 // which causes random crashes in the browser process. Our hack for now 2218 // which causes random crashes in the browser process. Our hack for now
2219 // is to not invoke the SetPriorityClass API if the dll is loaded. 2219 // is to not invoke the SetPriorityClass API if the dll is loaded.
2220 if (GetModuleHandle(L"cbstext.dll")) 2220 if (GetModuleHandle(L"cbstext.dll"))
2221 return; 2221 return;
2222 #endif // OS_WIN 2222 #endif // OS_WIN
2223 2223
2224 #if defined(OS_WIN) 2224 #if defined(OS_WIN) || defined(OS_MACOSX)
2225 // Same as below, but bound to an experiment (http://crbug.com/458594) 2225 // Same as below, but bound to an experiment (http://crbug.com/458594 on
2226 // initially on Windows. Enabled by default in the asbence of field trials to 2226 // Windows, http://crbug.com/398103 on the Mac). Enabled by default in the
2227 // get coverage on the perf waterfall. 2227 // absence of field trials to get coverage on the perf waterfall.
2228 base::FieldTrial* trial = 2228 base::FieldTrial* trial =
2229 base::FieldTrialList::Find("BackgroundRendererProcesses"); 2229 base::FieldTrialList::Find("BackgroundRendererProcesses");
2230 if (!trial || trial->group_name() != "Disallow") 2230 if (!trial || !StartsWithASCII(trial->group_name(), "Disallow", true)) {
2231 child_process_launcher_->SetProcessBackgrounded(backgrounded); 2231 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2232 }
2232 #else 2233 #else
2233 // Control the background state from the browser process, otherwise the task 2234 // Control the background state from the browser process, otherwise the task
2234 // telling the renderer to "unbackground" itself may be preempted by other 2235 // telling the renderer to "unbackground" itself may be preempted by other
2235 // tasks executing at lowered priority ahead of it or simply by not being 2236 // tasks executing at lowered priority ahead of it or simply by not being
2236 // swiftly scheduled by the OS per the low process priority 2237 // swiftly scheduled by the OS per the low process priority
2237 // (http://crbug.com/398103). 2238 // (http://crbug.com/398103).
2238 child_process_launcher_->SetProcessBackgrounded(backgrounded); 2239 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2239 #endif // OS_WIN 2240 #endif // OS_WIN
2240 2241
2241 // Notify the child process of background state. 2242 // Notify the child process of background state.
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
2457 if (worker_ref_count_ == 0) 2458 if (worker_ref_count_ == 0)
2458 Cleanup(); 2459 Cleanup();
2459 } 2460 }
2460 2461
2461 void RenderProcessHostImpl::GetAudioOutputControllers( 2462 void RenderProcessHostImpl::GetAudioOutputControllers(
2462 const GetAudioOutputControllersCallback& callback) const { 2463 const GetAudioOutputControllersCallback& callback) const {
2463 audio_renderer_host()->GetOutputControllers(callback); 2464 audio_renderer_host()->GetOutputControllers(callback);
2464 } 2465 }
2465 2466
2466 } // namespace content 2467 } // namespace content
OLDNEW
« base/process/process.h ('K') | « content/browser/child_process_launcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698