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

Unified Diff: media/audio/audio_output_dispatcher.cc

Issue 9255017: Add thread safety to AudioManagerBase to protect access to the audio thread member variable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix style issue Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_output_dispatcher.h ('k') | media/audio/audio_output_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_dispatcher.cc
diff --git a/media/audio/audio_output_dispatcher.cc b/media/audio/audio_output_dispatcher.cc
index 8e402777fc7052004f0e0ab7cc7c1353c1cd7e48..b1f265b48da6794cedf449c03250996230d714cc 100644
--- a/media/audio/audio_output_dispatcher.cc
+++ b/media/audio/audio_output_dispatcher.cc
@@ -14,7 +14,7 @@ AudioOutputDispatcher::AudioOutputDispatcher(
AudioManager* audio_manager, const AudioParameters& params,
base::TimeDelta close_delay)
: audio_manager_(audio_manager),
- message_loop_(audio_manager->GetMessageLoop()),
+ message_loop_(MessageLoop::current()),
params_(params),
pause_delay_(base::TimeDelta::FromMilliseconds(
2 * params.samples_per_packet *
@@ -25,7 +25,9 @@ AudioOutputDispatcher::AudioOutputDispatcher(
close_delay,
weak_this_.GetWeakPtr(),
&AudioOutputDispatcher::ClosePendingStreams) {
- DCHECK_EQ(MessageLoop::current(), message_loop_);
+ // We expect to be instantiated on the audio thread. Otherwise the
+ // message_loop_ member will point to the wrong message loop!
+ DCHECK(audio_manager->GetMessageLoop()->BelongsToCurrentThread());
}
AudioOutputDispatcher::~AudioOutputDispatcher() {
@@ -133,10 +135,6 @@ void AudioOutputDispatcher::Shutdown() {
pausing_streams_.clear();
}
-MessageLoop* AudioOutputDispatcher::message_loop() {
- return message_loop_;
-}
-
bool AudioOutputDispatcher::CreateAndOpenStream() {
AudioOutputStream* stream = audio_manager_->MakeAudioOutputStream(params_);
if (!stream)
« no previous file with comments | « media/audio/audio_output_dispatcher.h ('k') | media/audio/audio_output_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698