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

Unified Diff: media/audio/audio_manager_base.cc

Issue 11175066: Replace AudioManager::Init() with InitializeOnAudioThread(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 8 years, 2 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_manager_base.h ('k') | media/audio/audio_output_proxy_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_manager_base.cc
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
index 1963a615529621a6b4a3d75c8c42b9b3678b84ec..0c42cb0430c4710345144389ce131c4a6790f4ac 100644
--- a/media/audio/audio_manager_base.cc
+++ b/media/audio/audio_manager_base.cc
@@ -44,7 +44,15 @@ AudioManagerBase::AudioManagerBase()
max_num_output_streams_(kDefaultMaxOutputStreams),
max_num_input_streams_(kDefaultMaxInputStreams),
num_output_streams_(0),
- num_input_streams_(0) {
+ num_input_streams_(0),
+ audio_thread_(new base::Thread("AudioThread")) {
+#if defined(OS_WIN)
+ audio_thread_->init_com_with_mta(true);
+#endif
+ CHECK(audio_thread_->Start());
+ message_loop_ = audio_thread_->message_loop_proxy();
+ message_loop_->PostTask(FROM_HERE, base::Bind(
+ &AudioManagerBase::InitializeOnAudioThread, base::Unretained(this)));
}
AudioManagerBase::~AudioManagerBase() {
@@ -60,15 +68,8 @@ AudioManagerBase::~AudioManagerBase() {
DCHECK_EQ(0, num_input_streams_);
}
-void AudioManagerBase::Init() {
- base::AutoLock lock(audio_thread_lock_);
- DCHECK(!audio_thread_.get());
- audio_thread_.reset(new base::Thread("AudioThread"));
-#if defined(OS_WIN)
- audio_thread_->init_com_with_mta(true);
-#endif
- CHECK(audio_thread_->Start());
- message_loop_ = audio_thread_->message_loop_proxy();
+void AudioManagerBase::InitializeOnAudioThread() {
+ DCHECK(message_loop_->BelongsToCurrentThread());
}
string16 AudioManagerBase::GetAudioInputDeviceModel() {
« no previous file with comments | « media/audio/audio_manager_base.h ('k') | media/audio/audio_output_proxy_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698