| Index: chrome/browser/renderer_host/browser_render_process_host.cc
|
| ===================================================================
|
| --- chrome/browser/renderer_host/browser_render_process_host.cc (revision 10666)
|
| +++ chrome/browser/renderer_host/browser_render_process_host.cc (working copy)
|
| @@ -833,9 +833,23 @@
|
| void BrowserRenderProcessHost::SetBackgrounded(bool backgrounded) {
|
| // If the process_ is NULL, the process hasn't been created yet.
|
| if (process_.handle()) {
|
| - bool rv = process_.SetProcessBackgrounded(backgrounded);
|
| - if (!rv) {
|
| - return;
|
| + bool should_set_backgrounded = true;
|
| +
|
| +#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
|
| + // background thread. If the UI thread invokes this API just when it is
|
| + // intercepted the stack is messed up on return from the interceptor
|
| + // which causes random crashes in the browser process. Our hack for now
|
| + // is to not invoke the SetPriorityClass API if the dll is loaded.
|
| + should_set_backgrounded = (GetModuleHandle(L"cbstext.dll") == NULL);
|
| +#endif // OS_WIN
|
| +
|
| + if (should_set_backgrounded) {
|
| + bool rv = process_.SetProcessBackgrounded(backgrounded);
|
| + if (!rv) {
|
| + return;
|
| + }
|
| }
|
|
|
| // Now tune the memory footprint of the renderer.
|
|
|