| OLD | NEW |
| 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 #include "content/browser/renderer_host/media/audio_renderer_host.h" | 5 #include "content/browser/renderer_host/media/audio_renderer_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/memory/shared_memory.h" | 9 #include "base/memory/shared_memory.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 const RenderViewHost::GetAudioOutputControllersCallback& callback) const { | 148 const RenderViewHost::GetAudioOutputControllersCallback& callback) const { |
| 149 BrowserThread::PostTaskAndReplyWithResult( | 149 BrowserThread::PostTaskAndReplyWithResult( |
| 150 BrowserThread::IO, | 150 BrowserThread::IO, |
| 151 FROM_HERE, | 151 FROM_HERE, |
| 152 base::Bind(&AudioRendererHost::DoGetOutputControllers, this, | 152 base::Bind(&AudioRendererHost::DoGetOutputControllers, this, |
| 153 render_view_id), | 153 render_view_id), |
| 154 callback); | 154 callback); |
| 155 } | 155 } |
| 156 | 156 |
| 157 void AudioRendererHost::OnChannelClosing() { | 157 void AudioRendererHost::OnChannelClosing() { |
| 158 // Since the IPC channel is gone, close all requested audio streams. | 158 // Since the IPC sender is gone, close all requested audio streams. |
| 159 while (!audio_entries_.empty()) { | 159 while (!audio_entries_.empty()) { |
| 160 // Note: OnCloseStream() removes the entries from audio_entries_. | 160 // Note: OnCloseStream() removes the entries from audio_entries_. |
| 161 OnCloseStream(audio_entries_.begin()->first); | 161 OnCloseStream(audio_entries_.begin()->first); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 void AudioRendererHost::OnDestruct() const { | 165 void AudioRendererHost::OnDestruct() const { |
| 166 BrowserThread::DeleteOnIOThread::Destruct(this); | 166 BrowserThread::DeleteOnIOThread::Destruct(this); |
| 167 } | 167 } |
| 168 | 168 |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 498 |
| 499 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); | 499 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); |
| 500 return i != audio_entries_.end() ? i->second : NULL; | 500 return i != audio_entries_.end() ? i->second : NULL; |
| 501 } | 501 } |
| 502 | 502 |
| 503 bool AudioRendererHost::HasActiveAudio() { | 503 bool AudioRendererHost::HasActiveAudio() { |
| 504 return !base::AtomicRefCountIsZero(&num_playing_streams_); | 504 return !base::AtomicRefCountIsZero(&num_playing_streams_); |
| 505 } | 505 } |
| 506 | 506 |
| 507 } // namespace content | 507 } // namespace content |
| OLD | NEW |