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

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

Powered by Google App Engine
This is Rietveld 408576698