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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 media_stream_manager_(media_stream_manager) { | 121 media_stream_manager_(media_stream_manager) { |
122 DCHECK(audio_manager_); | 122 DCHECK(audio_manager_); |
123 DCHECK(media_stream_manager_); | 123 DCHECK(media_stream_manager_); |
124 } | 124 } |
125 | 125 |
126 AudioRendererHost::~AudioRendererHost() { | 126 AudioRendererHost::~AudioRendererHost() { |
127 DCHECK(audio_entries_.empty()); | 127 DCHECK(audio_entries_.empty()); |
128 } | 128 } |
129 | 129 |
130 void AudioRendererHost::OnChannelClosing() { | 130 void AudioRendererHost::OnChannelClosing() { |
131 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | |
132 | |
133 BrowserMessageFilter::OnChannelClosing(); | |
134 | |
135 // Since the IPC channel is gone, close all requested audio streams. | 131 // Since the IPC channel is gone, close all requested audio streams. |
136 while (!audio_entries_.empty()) { | 132 while (!audio_entries_.empty()) { |
137 // Note: OnCloseStream() removes the entries from audio_entries_. | 133 // Note: OnCloseStream() removes the entries from audio_entries_. |
138 OnCloseStream(audio_entries_.begin()->first); | 134 OnCloseStream(audio_entries_.begin()->first); |
139 } | 135 } |
140 } | 136 } |
141 | 137 |
142 void AudioRendererHost::OnDestruct() const { | 138 void AudioRendererHost::OnDestruct() const { |
143 BrowserThread::DeleteOnIOThread::Destruct(this); | 139 BrowserThread::DeleteOnIOThread::Destruct(this); |
144 } | 140 } |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 } | 475 } |
480 | 476 |
481 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(int stream_id) { | 477 AudioRendererHost::AudioEntry* AudioRendererHost::LookupById(int stream_id) { |
482 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 478 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
483 | 479 |
484 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); | 480 AudioEntryMap::const_iterator i = audio_entries_.find(stream_id); |
485 return i != audio_entries_.end() ? i->second : NULL; | 481 return i != audio_entries_.end() ? i->second : NULL; |
486 } | 482 } |
487 | 483 |
488 } // namespace content | 484 } // namespace content |
OLD | NEW |