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

Side by Side Diff: media/audio/audio_manager_base.cc

Issue 1116683002: [media] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased patch Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « media/audio/audio_input_controller.cc ('k') | media/base/android/media_decoder_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "media/audio/audio_manager_base.h" 5 #include "media/audio/audio_manager_base.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/single_thread_task_runner.h"
10 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/thread_task_runner_handle.h"
11 #include "build/build_config.h" 13 #include "build/build_config.h"
12 #include "media/audio/audio_output_dispatcher_impl.h" 14 #include "media/audio/audio_output_dispatcher_impl.h"
13 #include "media/audio/audio_output_proxy.h" 15 #include "media/audio/audio_output_proxy.h"
14 #include "media/audio/audio_output_resampler.h" 16 #include "media/audio/audio_output_resampler.h"
15 #include "media/audio/fake_audio_input_stream.h" 17 #include "media/audio/fake_audio_input_stream.h"
16 #include "media/audio/fake_audio_output_stream.h" 18 #include "media/audio/fake_audio_output_stream.h"
17 #include "media/base/media_switches.h" 19 #include "media/base/media_switches.h"
18 20
19 namespace media { 21 namespace media {
20 22
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 audio_thread_("AudioThread"), 85 audio_thread_("AudioThread"),
84 audio_log_factory_(audio_log_factory) { 86 audio_log_factory_(audio_log_factory) {
85 #if defined(OS_WIN) 87 #if defined(OS_WIN)
86 audio_thread_.init_com_with_mta(true); 88 audio_thread_.init_com_with_mta(true);
87 #elif defined(OS_MACOSX) 89 #elif defined(OS_MACOSX)
88 // CoreAudio calls must occur on the main thread of the process, which in our 90 // CoreAudio calls must occur on the main thread of the process, which in our
89 // case is sadly the browser UI thread. Failure to execute calls on the right 91 // case is sadly the browser UI thread. Failure to execute calls on the right
90 // thread leads to crashes and odd behavior. See http://crbug.com/158170. 92 // thread leads to crashes and odd behavior. See http://crbug.com/158170.
91 // TODO(dalecurtis): We should require the message loop to be passed in. 93 // TODO(dalecurtis): We should require the message loop to be passed in.
92 if (base::MessageLoopForUI::IsCurrent()) { 94 if (base::MessageLoopForUI::IsCurrent()) {
93 task_runner_ = base::MessageLoopProxy::current(); 95 task_runner_ = base::ThreadTaskRunnerHandle::Get();
94 return; 96 return;
95 } 97 }
96 #endif 98 #endif
97 99
98 CHECK(audio_thread_.Start()); 100 CHECK(audio_thread_.Start());
99 task_runner_ = audio_thread_.message_loop_proxy(); 101 task_runner_ = audio_thread_.message_loop_proxy();
100 } 102 }
101 103
102 AudioManagerBase::~AudioManagerBase() { 104 AudioManagerBase::~AudioManagerBase() {
103 // The platform specific AudioManager implementation must have already 105 // The platform specific AudioManager implementation must have already
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog( 400 scoped_ptr<AudioLog> AudioManagerBase::CreateAudioLog(
399 AudioLogFactory::AudioComponent component) { 401 AudioLogFactory::AudioComponent component) {
400 return audio_log_factory_->CreateAudioLog(component); 402 return audio_log_factory_->CreateAudioLog(component);
401 } 403 }
402 404
403 void AudioManagerBase::SetHasKeyboardMic() { 405 void AudioManagerBase::SetHasKeyboardMic() {
404 NOTREACHED(); 406 NOTREACHED();
405 } 407 }
406 408
407 } // namespace media 409 } // namespace media
OLDNEW
« no previous file with comments | « media/audio/audio_input_controller.cc ('k') | media/base/android/media_decoder_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698