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

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

Issue 926663002: Handle RenderProcessHostImpl::SetBackgrounded on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@908473002_ps2
Patch Set: as an experiment Created 5 years, 10 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 | « chrome/browser/renderer_host/render_process_host_chrome_browsertest.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 (c) 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>
(...skipping 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 // The cbstext.dll loads as a global GetMessage hook in the browser process 2198 // The cbstext.dll loads as a global GetMessage hook in the browser process
2199 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a 2199 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a
2200 // background thread. If the UI thread invokes this API just when it is 2200 // background thread. If the UI thread invokes this API just when it is
2201 // intercepted the stack is messed up on return from the interceptor 2201 // intercepted the stack is messed up on return from the interceptor
2202 // which causes random crashes in the browser process. Our hack for now 2202 // which causes random crashes in the browser process. Our hack for now
2203 // is to not invoke the SetPriorityClass API if the dll is loaded. 2203 // is to not invoke the SetPriorityClass API if the dll is loaded.
2204 if (GetModuleHandle(L"cbstext.dll")) 2204 if (GetModuleHandle(L"cbstext.dll"))
2205 return; 2205 return;
2206 #endif // OS_WIN 2206 #endif // OS_WIN
2207 2207
2208 #if defined(OS_WIN)
2209 // Same as below, but bound to an experiment initially on Windows
2210 // (http://crbug.com/458594). Enabled by default in the asbence of field
2211 // trials to get coverage on the perf waterfall.
2212 base::FieldTrial* trial =
2213 base::FieldTrialList::Find("BackgroundRendererProcesses");
2214 if (!trial || trial->group_name() != "Disallow")
2215 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2216 #else
2217 // Control the background state from the browser process, otherwise the task
2218 // telling the renderer to "unbackground" itself may be preempted by other
2219 // tasks executing at lowered priority ahead of it or simply by not being
2220 // switfly scheduled by the OS per the low process priority
jam 2015/02/17 23:15:25 nit: swiftly
gab 2015/02/18 14:42:22 Done.
2221 // (http://crbug.com/398103).
2222 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2223 #endif // OS_WIN
2224
2208 // Notify the child process of background state. 2225 // Notify the child process of background state.
2209 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded)); 2226 Send(new ChildProcessMsg_SetProcessBackgrounded(backgrounded));
2210
2211 #if !defined(OS_WIN)
2212 // Backgrounding may require elevated privileges not available to renderer
2213 // processes, so control backgrounding from the process host.
2214
2215 // Windows Vista+ has a fancy process backgrounding mode that can only be set
2216 // from within the process.
2217 child_process_launcher_->SetProcessBackgrounded(backgrounded);
2218 #endif // !OS_WIN
2219 } 2227 }
2220 2228
2221 void RenderProcessHostImpl::OnProcessLaunched() { 2229 void RenderProcessHostImpl::OnProcessLaunched() {
2222 // No point doing anything, since this object will be destructed soon. We 2230 // No point doing anything, since this object will be destructed soon. We
2223 // especially don't want to send the RENDERER_PROCESS_CREATED notification, 2231 // especially don't want to send the RENDERER_PROCESS_CREATED notification,
2224 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to 2232 // since some clients might expect a RENDERER_PROCESS_TERMINATED afterwards to
2225 // properly cleanup. 2233 // properly cleanup.
2226 if (deleting_soon_) 2234 if (deleting_soon_)
2227 return; 2235 return;
2228 2236
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
2397 if (worker_ref_count_ == 0) 2405 if (worker_ref_count_ == 0)
2398 Cleanup(); 2406 Cleanup();
2399 } 2407 }
2400 2408
2401 void RenderProcessHostImpl::GetAudioOutputControllers( 2409 void RenderProcessHostImpl::GetAudioOutputControllers(
2402 const GetAudioOutputControllersCallback& callback) const { 2410 const GetAudioOutputControllersCallback& callback) const {
2403 audio_renderer_host()->GetOutputControllers(callback); 2411 audio_renderer_host()->GetOutputControllers(callback);
2404 } 2412 }
2405 2413
2406 } // namespace content 2414 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/render_process_host_chrome_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698