Chromium Code Reviews| Index: content/browser/renderer_host/render_process_host_impl.cc |
| diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
| index 3471e3c087df2e43716a1bd742defd22d7326c79..b3b1c5d07605dca7d81855c0636bc8ffb2fdda8d 100644 |
| --- a/content/browser/renderer_host/render_process_host_impl.cc |
| +++ b/content/browser/renderer_host/render_process_host_impl.cc |
| @@ -1092,6 +1092,28 @@ int RenderProcessHostImpl::VisibleWidgetCount() const { |
| return visible_widgets_; |
| } |
| +void RenderProcessHostImpl::AudioStopped() { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + |
| + // If the backgrounding was skipped because audio was playing, background the |
| + // tab now. |
| + if (backgrounded_) |
| + SetBackgrounded(true); |
| +} |
| + |
| +void RenderProcessHostImpl::AudioStarted() { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| + |
| + // If audio starts playing from a backgrounded tab, un-background it. |
| + if (backgrounded_) { |
| + SetBackgrounded(false); |
| + |
| + // Since it's not a visible tab, it needs to be marked for backgrounding |
| + // again so that it is re-backgrounded if/when the audio stops. |
| + SetBackgrounded(true); |
|
ncarter (slow)
2015/07/06 21:53:57
I think we should fix things up so that this hack
gab
2015/07/08 18:52:14
Proposed skeleton SGTM, the AudioRendererHost coul
sebsg
2015/08/02 16:44:23
Done.
sebsg
2015/08/02 16:44:23
Done.
|
| + } |
| +} |
| + |
| bool RenderProcessHostImpl::IsForGuestsOnly() const { |
| return is_for_guests_only_; |
| } |
| @@ -2237,6 +2259,7 @@ void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { |
| } |
| void RenderProcessHostImpl::SetBackgrounded(bool backgrounded) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| TRACE_EVENT1("renderer_host", "RenderProcessHostImpl::SetBackgrounded", |
| "backgrounded", backgrounded); |
| // Note: we always set the backgrounded_ value. If the process is NULL |