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

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

Issue 298253004: Don't background processes with active audio output. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment. Created 6 years, 6 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 | Annotate | Revision Log
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 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 } 1931 }
1932 1932
1933 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { 1933 void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) {
1934 // Note: we always set the backgrounded_ value. If the process is NULL 1934 // Note: we always set the backgrounded_ value. If the process is NULL
1935 // (and hence hasn't been created yet), we will set the process priority 1935 // (and hence hasn't been created yet), we will set the process priority
1936 // later when we create the process. 1936 // later when we create the process.
1937 backgrounded_ = backgrounded; 1937 backgrounded_ = backgrounded;
1938 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting()) 1938 if (!child_process_launcher_.get() || child_process_launcher_->IsStarting())
1939 return; 1939 return;
1940 1940
1941 // Don't background processes which have active audio streams.
1942 if (backgrounded_ && audio_renderer_host_->HasActiveAudio())
1943 return;
1944
1941 #if defined(OS_WIN) 1945 #if defined(OS_WIN)
1942 // The cbstext.dll loads as a global GetMessage hook in the browser process 1946 // The cbstext.dll loads as a global GetMessage hook in the browser process
1943 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a 1947 // and intercepts/unintercepts the kernel32 API SetPriorityClass in a
1944 // background thread. If the UI thread invokes this API just when it is 1948 // background thread. If the UI thread invokes this API just when it is
1945 // intercepted the stack is messed up on return from the interceptor 1949 // intercepted the stack is messed up on return from the interceptor
1946 // which causes random crashes in the browser process. Our hack for now 1950 // which causes random crashes in the browser process. Our hack for now
1947 // is to not invoke the SetPriorityClass API if the dll is loaded. 1951 // is to not invoke the SetPriorityClass API if the dll is loaded.
1948 if (GetModuleHandle(L"cbstext.dll")) 1952 if (GetModuleHandle(L"cbstext.dll"))
1949 return; 1953 return;
1950 #endif // OS_WIN 1954 #endif // OS_WIN
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2073 mojo::ScopedMessagePipeHandle handle) { 2077 mojo::ScopedMessagePipeHandle handle) {
2074 mojo_activation_required_ = true; 2078 mojo_activation_required_ = true;
2075 MaybeActivateMojo(); 2079 MaybeActivateMojo();
2076 2080
2077 mojo::AllocationScope scope; 2081 mojo::AllocationScope scope;
2078 mojo_application_host_->service_provider()->ConnectToService(service_name, 2082 mojo_application_host_->service_provider()->ConnectToService(service_name,
2079 handle.Pass()); 2083 handle.Pass());
2080 } 2084 }
2081 2085
2082 } // namespace content 2086 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698