diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-22 22:40:03 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-22 22:40:03 +0000 |
commit | fb5af2366bf2001c357ca0a0fffca800531eef46 (patch) | |
tree | 71e8568c312810fbc091336ff22068da09057912 /media/audio | |
parent | 06ff88b35ec9062666a08c53f74d1990d85c745b (diff) | |
download | chromium_src-fb5af2366bf2001c357ca0a0fffca800531eef46.zip chromium_src-fb5af2366bf2001c357ca0a0fffca800531eef46.tar.gz chromium_src-fb5af2366bf2001c357ca0a0fffca800531eef46.tar.bz2 |
Use base::MessageLoop in media code.
MessageLoop is moved to base namespace in r191566. This CL is the followup
cleanup in media code.
The following folders are replaced:
chrome/browser/media
content/browser/renderer_host/media
content/common/gpu/media
content/common/media
content/renderer/media
media
webkit/media
The following command is used to make sure all instances in these folders are updated:
grep -rin '[^a-zA-Z]MessageLoop[^a-zA-Z]' media chrome/browser/media content/browser/renderer_host/media content/common/gpu/media content/common/media content/renderer/media webkit/media | grep -v 'base::MessageLoop' | grep -v 'class MessageLoop'
Review URL: https://chromiumcodereview.appspot.com/14385002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195626 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio')
31 files changed, 113 insertions, 108 deletions
diff --git a/media/audio/async_socket_io_handler.h b/media/audio/async_socket_io_handler.h index d17e3d3..7497c50 100644 --- a/media/audio/async_socket_io_handler.h +++ b/media/audio/async_socket_io_handler.h @@ -14,9 +14,9 @@ namespace media { // The message loop callback interface is different based on platforms. #if defined(OS_WIN) -typedef MessageLoopForIO::IOHandler MessageLoopIOHandler; +typedef base::MessageLoopForIO::IOHandler MessageLoopIOHandler; #elif defined(OS_POSIX) -typedef MessageLoopForIO::Watcher MessageLoopIOHandler; +typedef base::MessageLoopForIO::Watcher MessageLoopIOHandler; #endif // Extends the CancelableSyncSocket class to allow reading from a socket @@ -79,11 +79,11 @@ class MEDIA_EXPORT AsyncSocketIoHandler private: #if defined(OS_WIN) // Implementation of IOHandler on Windows. - virtual void OnIOCompleted(MessageLoopForIO::IOContext* context, + virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context, DWORD bytes_transfered, DWORD error) OVERRIDE; #elif defined(OS_POSIX) - // Implementation of MessageLoopForIO::Watcher. + // Implementation of base::MessageLoopForIO::Watcher. virtual void OnFileCanWriteWithoutBlocking(int socket) OVERRIDE {} virtual void OnFileCanReadWithoutBlocking(int socket) OVERRIDE; @@ -92,10 +92,10 @@ class MEDIA_EXPORT AsyncSocketIoHandler base::SyncSocket::Handle socket_; #if defined(OS_WIN) - MessageLoopForIO::IOContext* context_; + base::MessageLoopForIO::IOContext* context_; bool is_pending_; #elif defined(OS_POSIX) - MessageLoopForIO::FileDescriptorWatcher socket_watcher_; + base::MessageLoopForIO::FileDescriptorWatcher socket_watcher_; // |pending_buffer_| and |pending_buffer_len_| are valid only between // Read() and OnFileCanReadWithoutBlocking(). char* pending_buffer_; diff --git a/media/audio/async_socket_io_handler_posix.cc b/media/audio/async_socket_io_handler_posix.cc index eeec7c1..815c628 100644 --- a/media/audio/async_socket_io_handler_posix.cc +++ b/media/audio/async_socket_io_handler_posix.cc @@ -89,8 +89,9 @@ bool AsyncSocketIoHandler::Initialize(base::SyncSocket::Handle socket, void AsyncSocketIoHandler::EnsureWatchingSocket() { DCHECK(CalledOnValidThread()); if (!is_watching_ && socket_ != base::SyncSocket::kInvalidHandle) { - is_watching_ = MessageLoopForIO::current()->WatchFileDescriptor( - socket_, true, MessageLoopForIO::WATCH_READ, &socket_watcher_, this); + is_watching_ = base::MessageLoopForIO::current()->WatchFileDescriptor( + socket_, true, base::MessageLoopForIO::WATCH_READ, + &socket_watcher_, this); } } diff --git a/media/audio/async_socket_io_handler_unittest.cc b/media/audio/async_socket_io_handler_unittest.cc index c7fa47b..a2505d2 100644 --- a/media/audio/async_socket_io_handler_unittest.cc +++ b/media/audio/async_socket_io_handler_unittest.cc @@ -44,7 +44,7 @@ class TestSocketReader { EXPECT_GT(bytes_read, 0); ++callbacks_received_; if (number_of_reads_before_quit_ == callbacks_received_) { - MessageLoop::current()->Quit(); + base::MessageLoop::current()->Quit(); } else if (issue_reads_from_callback_) { IssueRead(); } @@ -71,7 +71,7 @@ void SendData(base::CancelableSyncSocket* socket, // Tests doing a pending read from a socket and use an IO handler to get // notified of data. TEST(AsyncSocketIoHandlerTest, AsynchronousReadWithMessageLoop) { - MessageLoopForIO loop; + base::MessageLoopForIO loop; base::CancelableSyncSocket pair[2]; ASSERT_TRUE(base::CancelableSyncSocket::CreatePair(&pair[0], &pair[1])); @@ -80,7 +80,7 @@ TEST(AsyncSocketIoHandlerTest, AsynchronousReadWithMessageLoop) { EXPECT_TRUE(reader.IssueRead()); pair[1].Send(kAsyncSocketIoTestString, kAsyncSocketIoTestStringLength); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(strcmp(reader.buffer(), kAsyncSocketIoTestString), 0); EXPECT_EQ(1, reader.callbacks_received()); } @@ -89,7 +89,7 @@ TEST(AsyncSocketIoHandlerTest, AsynchronousReadWithMessageLoop) { // socket. Here we want to make sure that any async 'can read' notifications // won't trip us off and that the synchronous case works as well. TEST(AsyncSocketIoHandlerTest, SynchronousReadWithMessageLoop) { - MessageLoopForIO loop; + base::MessageLoopForIO loop; base::CancelableSyncSocket pair[2]; ASSERT_TRUE(base::CancelableSyncSocket::CreatePair(&pair[0], &pair[1])); @@ -97,9 +97,10 @@ TEST(AsyncSocketIoHandlerTest, SynchronousReadWithMessageLoop) { TestSocketReader reader(&pair[0], -1, false); pair[1].Send(kAsyncSocketIoTestString, kAsyncSocketIoTestStringLength); - MessageLoop::current()->PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + base::MessageLoop::current()->PostDelayedTask(FROM_HERE, + base::MessageLoop::QuitClosure(), base::TimeDelta::FromMilliseconds(100)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_TRUE(reader.IssueRead()); EXPECT_EQ(strcmp(reader.buffer(), kAsyncSocketIoTestString), 0); @@ -109,13 +110,13 @@ TEST(AsyncSocketIoHandlerTest, SynchronousReadWithMessageLoop) { // So we call RunUntilIdle() to allow any event notifications or APC's on // Windows, to execute before checking the count of how many callbacks we've // received. - MessageLoop::current()->RunUntilIdle(); + base::MessageLoop::current()->RunUntilIdle(); EXPECT_EQ(1, reader.callbacks_received()); } // Calls Read() from within a callback to test that simple read "loops" work. TEST(AsyncSocketIoHandlerTest, ReadFromCallback) { - MessageLoopForIO loop; + base::MessageLoopForIO loop; base::CancelableSyncSocket pair[2]; ASSERT_TRUE(base::CancelableSyncSocket::CreatePair(&pair[0], &pair[1])); @@ -127,16 +128,17 @@ TEST(AsyncSocketIoHandlerTest, ReadFromCallback) { // Issue sends on an interval to satisfy the Read() requirements. int64 milliseconds = 0; for (int i = 0; i < kReadOperationCount; ++i) { - MessageLoop::current()->PostDelayedTask(FROM_HERE, + base::MessageLoop::current()->PostDelayedTask(FROM_HERE, base::Bind(&SendData, &pair[1], kAsyncSocketIoTestString, kAsyncSocketIoTestStringLength), base::TimeDelta::FromMilliseconds(milliseconds)); milliseconds += 10; } - MessageLoop::current()->PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + base::MessageLoop::current()->PostDelayedTask(FROM_HERE, + base::MessageLoop::QuitClosure(), base::TimeDelta::FromMilliseconds(100 + milliseconds)); - MessageLoop::current()->Run(); + base::MessageLoop::current()->Run(); EXPECT_EQ(kReadOperationCount, reader.callbacks_received()); } diff --git a/media/audio/async_socket_io_handler_win.cc b/media/audio/async_socket_io_handler_win.cc index f83f405..ea6bd4a 100644 --- a/media/audio/async_socket_io_handler_win.cc +++ b/media/audio/async_socket_io_handler_win.cc @@ -27,9 +27,10 @@ AsyncSocketIoHandler::~AsyncSocketIoHandler() { } // Implementation of IOHandler on Windows. -void AsyncSocketIoHandler::OnIOCompleted(MessageLoopForIO::IOContext* context, - DWORD bytes_transfered, - DWORD error) { +void AsyncSocketIoHandler::OnIOCompleted( + base::MessageLoopForIO::IOContext* context, + DWORD bytes_transfered, + DWORD error) { DCHECK(CalledOnValidThread()); DCHECK_EQ(context_, context); DCHECK(!read_complete_.is_null()); @@ -64,9 +65,9 @@ bool AsyncSocketIoHandler::Initialize(base::SyncSocket::Handle socket, socket_ = socket; read_complete_ = callback; - MessageLoopForIO::current()->RegisterIOHandler(socket, this); + base::MessageLoopForIO::current()->RegisterIOHandler(socket, this); - context_ = new MessageLoopForIO::IOContext(); + context_ = new base::MessageLoopForIO::IOContext(); context_->handler = this; memset(&context_->overlapped, 0, sizeof(context_->overlapped)); diff --git a/media/audio/audio_device_thread.cc b/media/audio/audio_device_thread.cc index 29dc291..7583c9e 100644 --- a/media/audio/audio_device_thread.cc +++ b/media/audio/audio_device_thread.cc @@ -37,7 +37,7 @@ class AudioDeviceThread::Thread // a task to join (close) the thread handle later instead of waiting for // the thread. If loop_for_join is NULL, then the function waits // synchronously for the thread to terminate. - void Stop(MessageLoop* loop_for_join); + void Stop(base::MessageLoop* loop_for_join); private: friend class base::RefCountedThreadSafe<AudioDeviceThread::Thread>; @@ -77,7 +77,7 @@ void AudioDeviceThread::Start(AudioDeviceThread::Callback* callback, thread_->Start(); } -void AudioDeviceThread::Stop(MessageLoop* loop_for_join) { +void AudioDeviceThread::Stop(base::MessageLoop* loop_for_join) { base::AutoLock auto_lock(thread_lock_); if (thread_) { thread_->Stop(loop_for_join); @@ -115,7 +115,7 @@ void AudioDeviceThread::Thread::Start() { CHECK(thread_ != base::kNullThreadHandle); } -void AudioDeviceThread::Thread::Stop(MessageLoop* loop_for_join) { +void AudioDeviceThread::Thread::Stop(base::MessageLoop* loop_for_join) { socket_.Shutdown(); base::PlatformThreadHandle thread = base::kNullThreadHandle; diff --git a/media/audio/audio_input_controller_unittest.cc b/media/audio/audio_input_controller_unittest.cc index 743e7b4..43d3e69 100644 --- a/media/audio/audio_input_controller_unittest.cc +++ b/media/audio/audio_input_controller_unittest.cc @@ -24,23 +24,23 @@ static const int kBitsPerSample = 16; static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO; static const int kSamplesPerPacket = kSampleRate / 10; -// Posts MessageLoop::QuitClosure() on specified message loop. +// Posts base::MessageLoop::QuitClosure() on specified message loop. ACTION_P(QuitMessageLoop, loop_or_proxy) { - loop_or_proxy->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + loop_or_proxy->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } -// Posts MessageLoop::QuitClosure() on specified message loop after a certain -// number of calls given by |limit|. +// Posts base::MessageLoop::QuitClosure() on specified message loop after a +// certain number of calls given by |limit|. ACTION_P3(CheckCountAndPostQuitTask, count, limit, loop_or_proxy) { if (++*count >= limit) { - loop_or_proxy->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + loop_or_proxy->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } } // Closes AudioOutputController synchronously. static void CloseAudioController(AudioInputController* controller) { - controller->Close(MessageLoop::QuitClosure()); - MessageLoop::current()->Run(); + controller->Close(base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->Run(); } class MockAudioInputControllerEventHandler @@ -65,7 +65,7 @@ class AudioInputControllerTest : public testing::Test { virtual ~AudioInputControllerTest() {} protected: - MessageLoop message_loop_; + base::MessageLoop message_loop_; private: DISALLOW_COPY_AND_ASSIGN(AudioInputControllerTest); @@ -219,11 +219,11 @@ TEST_F(AudioInputControllerTest, CloseTwice) { controller->Record(); - controller->Close(MessageLoop::QuitClosure()); - MessageLoop::current()->Run(); + controller->Close(base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->Run(); - controller->Close(MessageLoop::QuitClosure()); - MessageLoop::current()->Run(); + controller->Close(base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->Run(); } } // namespace media diff --git a/media/audio/audio_input_device.cc b/media/audio/audio_input_device.cc index a3e79ab..d272ec7 100644 --- a/media/audio/audio_input_device.cc +++ b/media/audio/audio_input_device.cc @@ -87,7 +87,7 @@ void AudioInputDevice::Stop() { { base::AutoLock auto_lock(audio_thread_lock_); - audio_thread_.Stop(MessageLoop::current()); + audio_thread_.Stop(base::MessageLoop::current()); stopping_hack_ = true; } diff --git a/media/audio/audio_input_device.h b/media/audio/audio_input_device.h index fd6ff42..6a7b304 100644 --- a/media/audio/audio_input_device.h +++ b/media/audio/audio_input_device.h @@ -125,7 +125,7 @@ class MEDIA_EXPORT AudioInputDevice void SetVolumeOnIOThread(double volume); void SetAutomaticGainControlOnIOThread(bool enabled); - // MessageLoop::DestructionObserver implementation for the IO loop. + // base::MessageLoop::DestructionObserver implementation for the IO loop. // If the IO loop dies before we do, we shut down the audio thread from here. virtual void WillDestroyCurrentMessageLoop() OVERRIDE; diff --git a/media/audio/audio_input_unittest.cc b/media/audio/audio_input_unittest.cc index 6b13644..522809c 100644 --- a/media/audio/audio_input_unittest.cc +++ b/media/audio/audio_input_unittest.cc @@ -144,7 +144,7 @@ TEST(AudioInputTest, Record) { scoped_ptr<AudioManager> audio_man(AudioManager::Create()); if (!CanRunAudioTests(audio_man.get())) return; - MessageLoop message_loop(MessageLoop::TYPE_DEFAULT); + base::MessageLoop message_loop(base::MessageLoop::TYPE_DEFAULT); AudioInputStream* ais = CreateTestAudioInputStream(audio_man.get()); EXPECT_TRUE(ais->Open()); @@ -154,7 +154,7 @@ TEST(AudioInputTest, Record) { // extra time. message_loop.PostDelayedTask( FROM_HERE, - MessageLoop::QuitClosure(), + base::MessageLoop::QuitClosure(), base::TimeDelta::FromMilliseconds(690)); message_loop.Run(); EXPECT_GE(test_callback.callback_count(), 1); diff --git a/media/audio/audio_low_latency_input_output_unittest.cc b/media/audio/audio_low_latency_input_output_unittest.cc index 27f4873..0dc434f 100644 --- a/media/audio/audio_low_latency_input_output_unittest.cc +++ b/media/audio/audio_low_latency_input_output_unittest.cc @@ -84,7 +84,7 @@ class MockAudioManager : public AudioManagerAnyPlatform { virtual ~MockAudioManager() {} virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { - return MessageLoop::current()->message_loop_proxy(); + return base::MessageLoop::current()->message_loop_proxy(); } private: @@ -99,7 +99,7 @@ class AudioLowLatencyInputOutputTest : public testing::Test { virtual ~AudioLowLatencyInputOutputTest() {} AudioManager* audio_manager() { return &mock_audio_manager_; } - MessageLoopForUI* message_loop() { return &message_loop_; } + base::MessageLoopForUI* message_loop() { return &message_loop_; } // Convenience method which ensures that we are not running on the build // bots and that at least one valid input and output device can be found. @@ -112,7 +112,7 @@ class AudioLowLatencyInputOutputTest : public testing::Test { } private: - MessageLoopForUI message_loop_; + base::MessageLoopForUI message_loop_; MockAudioManager mock_audio_manager_; DISALLOW_COPY_AND_ASSIGN(AudioLowLatencyInputOutputTest); @@ -433,7 +433,7 @@ TEST_F(AudioLowLatencyInputOutputTest, DISABLED_FullDuplexDelayMeasurement) { // in loop back during this time. At the same time, delay recordings are // performed and stored in the output text file. message_loop()->PostDelayedTask(FROM_HERE, - MessageLoop::QuitClosure(), TestTimeouts::action_timeout()); + base::MessageLoop::QuitClosure(), TestTimeouts::action_timeout()); message_loop()->Run(); aos->Stop(); diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc index 23e8227..dab4b61 100644 --- a/media/audio/audio_manager_base.cc +++ b/media/audio/audio_manager_base.cc @@ -50,7 +50,7 @@ AudioManagerBase::AudioManagerBase() // On Mac, use a UI loop to get native message pump so that CoreAudio property // listener callbacks fire. CHECK(audio_thread_->StartWithOptions( - base::Thread::Options(MessageLoop::TYPE_UI, 0))); + base::Thread::Options(base::MessageLoop::TYPE_UI, 0))); #else CHECK(audio_thread_->Start()); #endif @@ -279,7 +279,7 @@ void AudioManagerBase::Shutdown() { if (!audio_thread.get()) return; - CHECK_NE(MessageLoop::current(), audio_thread->message_loop()); + CHECK_NE(base::MessageLoop::current(), audio_thread->message_loop()); // We must use base::Unretained since Shutdown might have been called from // the destructor and we can't alter the refcount of the object at that point. diff --git a/media/audio/audio_output_controller_unittest.cc b/media/audio/audio_output_controller_unittest.cc index 7511751..c6c2d45 100644 --- a/media/audio/audio_output_controller_unittest.cc +++ b/media/audio/audio_output_controller_unittest.cc @@ -223,8 +223,8 @@ class AudioOutputControllerTest : public testing::Test { void Close() { EXPECT_CALL(mock_sync_reader_, Close()); - controller_->Close(MessageLoop::QuitClosure()); - MessageLoop::current()->Run(); + controller_->Close(base::MessageLoop::QuitClosure()); + base::MessageLoop::current()->Run(); } // These help make test sequences more readable. @@ -249,7 +249,7 @@ class AudioOutputControllerTest : public testing::Test { void WaitForPause() { pause_event_.Wait(); } private: - MessageLoopForIO message_loop_; + base::MessageLoopForIO message_loop_; scoped_ptr<AudioManager> audio_manager_; MockAudioOutputControllerEventHandler mock_event_handler_; MockAudioOutputControllerSyncReader mock_sync_reader_; diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc index 48e46f6..192823a 100644 --- a/media/audio/audio_output_device.cc +++ b/media/audio/audio_output_device.cc @@ -83,7 +83,7 @@ void AudioOutputDevice::Start() { void AudioOutputDevice::Stop() { { base::AutoLock auto_lock(audio_thread_lock_); - audio_thread_.Stop(MessageLoop::current()); + audio_thread_.Stop(base::MessageLoop::current()); stopping_hack_ = true; } diff --git a/media/audio/audio_output_device.h b/media/audio/audio_output_device.h index 9ce2f22..a16b9ed 100644 --- a/media/audio/audio_output_device.h +++ b/media/audio/audio_output_device.h @@ -124,7 +124,7 @@ class MEDIA_EXPORT AudioOutputDevice void ShutDownOnIOThread(); void SetVolumeOnIOThread(double volume); - // MessageLoop::DestructionObserver implementation for the IO loop. + // base::MessageLoop::DestructionObserver implementation for the IO loop. // If the IO loop dies before we do, we shut down the audio thread from here. virtual void WillDestroyCurrentMessageLoop() OVERRIDE; diff --git a/media/audio/audio_output_device_unittest.cc b/media/audio/audio_output_device_unittest.cc index a59eb82..4605e63 100644 --- a/media/audio/audio_output_device_unittest.cc +++ b/media/audio/audio_output_device_unittest.cc @@ -83,7 +83,7 @@ ACTION_P2(SendPendingBytes, socket, pending_bytes) { // Used to terminate a loop from a different thread than the loop belongs to. // |loop| should be a MessageLoopProxy. ACTION_P(QuitLoop, loop) { - loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } } // namespace. @@ -105,7 +105,7 @@ class AudioOutputDeviceTest // Used to clean up TLS pointers that the test(s) will initialize. // Must remain the first member of this class. base::ShadowingAtExitManager at_exit_manager_; - MessageLoopForIO io_loop_; + base::MessageLoopForIO io_loop_; AudioParameters default_audio_parameters_; StrictMock<MockRenderCallback> callback_; MockAudioOutputIPC* audio_output_ipc_; // owned by audio_device_ @@ -231,7 +231,7 @@ void AudioOutputDeviceTest::ExpectRenderCallback() { void AudioOutputDeviceTest::WaitUntilRenderCallback() { // Don't hang the test if we never get the Render() callback. - io_loop_.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + io_loop_.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), TestTimeouts::action_timeout()); io_loop_.Run(); } diff --git a/media/audio/audio_output_dispatcher.cc b/media/audio/audio_output_dispatcher.cc index bfd3fb8..be9cb57 100644 --- a/media/audio/audio_output_dispatcher.cc +++ b/media/audio/audio_output_dispatcher.cc @@ -12,7 +12,7 @@ AudioOutputDispatcher::AudioOutputDispatcher( AudioManager* audio_manager, const AudioParameters& params) : audio_manager_(audio_manager), - message_loop_(MessageLoop::current()), + message_loop_(base::MessageLoop::current()), params_(params) { // We expect to be instantiated on the audio thread. Otherwise the // message_loop_ member will point to the wrong message loop! @@ -20,7 +20,7 @@ AudioOutputDispatcher::AudioOutputDispatcher( } AudioOutputDispatcher::~AudioOutputDispatcher() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); } } // namespace media diff --git a/media/audio/audio_output_dispatcher_impl.cc b/media/audio/audio_output_dispatcher_impl.cc index 183cc2f..ef09d73 100644 --- a/media/audio/audio_output_dispatcher_impl.cc +++ b/media/audio/audio_output_dispatcher_impl.cc @@ -39,7 +39,7 @@ AudioOutputDispatcherImpl::~AudioOutputDispatcherImpl() { } bool AudioOutputDispatcherImpl::OpenStream() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); paused_proxies_++; @@ -56,7 +56,7 @@ bool AudioOutputDispatcherImpl::OpenStream() { bool AudioOutputDispatcherImpl::StartStream( AudioOutputStream::AudioSourceCallback* callback, AudioOutputProxy* stream_proxy) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); if (idle_streams_.empty() && !CreateAndOpenStream()) return false; @@ -83,7 +83,7 @@ bool AudioOutputDispatcherImpl::StartStream( } void AudioOutputDispatcherImpl::StopStream(AudioOutputProxy* stream_proxy) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); AudioStreamMap::iterator it = proxy_to_physical_map_.find(stream_proxy); DCHECK(it != proxy_to_physical_map_.end()); @@ -106,7 +106,7 @@ void AudioOutputDispatcherImpl::StopStream(AudioOutputProxy* stream_proxy) { void AudioOutputDispatcherImpl::StreamVolumeSet(AudioOutputProxy* stream_proxy, double volume) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); AudioStreamMap::iterator it = proxy_to_physical_map_.find(stream_proxy); if (it != proxy_to_physical_map_.end()) { AudioOutputStream* physical_stream = it->second; @@ -115,7 +115,7 @@ void AudioOutputDispatcherImpl::StreamVolumeSet(AudioOutputProxy* stream_proxy, } void AudioOutputDispatcherImpl::StopStreamTask() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); if (pausing_streams_.empty()) return; @@ -127,7 +127,7 @@ void AudioOutputDispatcherImpl::StopStreamTask() { } void AudioOutputDispatcherImpl::CloseStream(AudioOutputProxy* stream_proxy) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); while (!pausing_streams_.empty()) { idle_streams_.push_back(pausing_streams_.back()); @@ -144,7 +144,7 @@ void AudioOutputDispatcherImpl::CloseStream(AudioOutputProxy* stream_proxy) { } void AudioOutputDispatcherImpl::Shutdown() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); // Cancel any pending tasks to close paused streams or create new ones. weak_this_.InvalidateWeakPtrs(); @@ -165,7 +165,7 @@ void AudioOutputDispatcherImpl::Shutdown() { } bool AudioOutputDispatcherImpl::CreateAndOpenStream() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); AudioOutputStream* stream = audio_manager_->MakeAudioOutputStream(params_); if (!stream) return false; @@ -179,7 +179,7 @@ bool AudioOutputDispatcherImpl::CreateAndOpenStream() { } void AudioOutputDispatcherImpl::OpenTask() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); // Make sure that we have at least one stream allocated if there // are paused streams. if (paused_proxies_ > 0 && idle_streams_.empty() && @@ -192,7 +192,7 @@ void AudioOutputDispatcherImpl::OpenTask() { // This method is called by |close_timer_|. void AudioOutputDispatcherImpl::ClosePendingStreams() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); while (!idle_streams_.empty()) { idle_streams_.back()->Close(); idle_streams_.pop_back(); diff --git a/media/audio/audio_output_proxy_unittest.cc b/media/audio/audio_output_proxy_unittest.cc index 224bbf5..e4891ef 100644 --- a/media/audio/audio_output_proxy_unittest.cc +++ b/media/audio/audio_output_proxy_unittest.cc @@ -446,7 +446,7 @@ class AudioOutputProxyTest : public testing::Test { proxy->Close(); } - MessageLoop message_loop_; + base::MessageLoop message_loop_; scoped_refptr<AudioOutputDispatcherImpl> dispatcher_impl_; base::TimeDelta pause_delay_; MockAudioManager manager_; diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc index 26d83f8..9584b72 100644 --- a/media/audio/audio_output_resampler.cc +++ b/media/audio/audio_output_resampler.cc @@ -177,7 +177,7 @@ void AudioOutputResampler::Initialize() { } bool AudioOutputResampler::OpenStream() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); if (dispatcher_->OpenStream()) { // Only record the UMA statistic if we didn't fallback during construction @@ -244,7 +244,7 @@ bool AudioOutputResampler::OpenStream() { bool AudioOutputResampler::StartStream( AudioOutputStream::AudioSourceCallback* callback, AudioOutputProxy* stream_proxy) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); OnMoreDataConverter* resampler_callback = NULL; CallbackMap::iterator it = callbacks_.find(stream_proxy); @@ -264,12 +264,12 @@ bool AudioOutputResampler::StartStream( void AudioOutputResampler::StreamVolumeSet(AudioOutputProxy* stream_proxy, double volume) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); dispatcher_->StreamVolumeSet(stream_proxy, volume); } void AudioOutputResampler::StopStream(AudioOutputProxy* stream_proxy) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); dispatcher_->StopStream(stream_proxy); // Now that StopStream() has completed the underlying physical stream should @@ -281,7 +281,7 @@ void AudioOutputResampler::StopStream(AudioOutputProxy* stream_proxy) { } void AudioOutputResampler::CloseStream(AudioOutputProxy* stream_proxy) { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); dispatcher_->CloseStream(stream_proxy); // We assume that StopStream() is always called prior to CloseStream(), so @@ -294,7 +294,7 @@ void AudioOutputResampler::CloseStream(AudioOutputProxy* stream_proxy) { } void AudioOutputResampler::Shutdown() { - DCHECK_EQ(MessageLoop::current(), message_loop_); + DCHECK_EQ(base::MessageLoop::current(), message_loop_); // No AudioOutputProxy objects should hold a reference to us when we get // to this stage. diff --git a/media/audio/fake_audio_consumer_unittest.cc b/media/audio/fake_audio_consumer_unittest.cc index 66077d5..362686c 100644 --- a/media/audio/fake_audio_consumer_unittest.cc +++ b/media/audio/fake_audio_consumer_unittest.cc @@ -76,11 +76,11 @@ class FakeAudioConsumerTest : public testing::Test { ASSERT_TRUE(message_loop_.message_loop_proxy()->BelongsToCurrentThread()); fake_consumer_.Stop(); EXPECT_LE(callbacks, source_.callbacks()); - message_loop_.PostTask(FROM_HERE, MessageLoop::QuitClosure()); + message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } protected: - MessageLoop message_loop_; + base::MessageLoop message_loop_; AudioParameters params_; FakeAudioConsumer fake_consumer_; SineWaveAudioSource source_; diff --git a/media/audio/linux/alsa_input.cc b/media/audio/linux/alsa_input.cc index bc3ab72..123b5f7 100644 --- a/media/audio/linux/alsa_input.cc +++ b/media/audio/linux/alsa_input.cc @@ -119,7 +119,7 @@ void AlsaPcmInputStream::Start(AudioInputCallback* callback) { // driver. This could also give us a smooth read sequence going forward. base::TimeDelta delay = buffer_duration_ + buffer_duration_ / 2; next_read_time_ = base::Time::Now() + delay; - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&AlsaPcmInputStream::ReadAudio, weak_factory_.GetWeakPtr()), delay); @@ -188,7 +188,7 @@ void AlsaPcmInputStream::ReadAudio() { } base::TimeDelta next_check_time = buffer_duration_ / 2; - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&AlsaPcmInputStream::ReadAudio, weak_factory_.GetWeakPtr()), next_check_time); @@ -230,7 +230,7 @@ void AlsaPcmInputStream::ReadAudio() { delay = base::TimeDelta(); } - MessageLoop::current()->PostDelayedTask( + base::MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&AlsaPcmInputStream::ReadAudio, weak_factory_.GetWeakPtr()), delay); diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index f3c3f91..5e193de 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -151,7 +151,7 @@ AlsaPcmOutputStream::AlsaPcmOutputStream(const std::string& device_name, stop_stream_(false), wrapper_(wrapper), manager_(manager), - message_loop_(MessageLoop::current()), + message_loop_(base::MessageLoop::current()), playback_handle_(NULL), frames_per_packet_(packet_size_ / bytes_per_frame_), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), @@ -737,7 +737,7 @@ AlsaPcmOutputStream::InternalState AlsaPcmOutputStream::state() { } bool AlsaPcmOutputStream::IsOnAudioThread() const { - return message_loop_ && message_loop_ == MessageLoop::current(); + return message_loop_ && message_loop_ == base::MessageLoop::current(); } int AlsaPcmOutputStream::RunDataCallback(AudioBus* audio_bus, diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc index d5d6be9..0dc19f5 100644 --- a/media/audio/linux/alsa_output_unittest.cc +++ b/media/audio/linux/alsa_output_unittest.cc @@ -100,7 +100,7 @@ class MockAudioManagerLinux : public AudioManagerLinux { // We don't mock this method since all tests will do the same thing // and use the current message loop. virtual scoped_refptr<base::MessageLoopProxy> GetMessageLoop() OVERRIDE { - return MessageLoop::current()->message_loop_proxy(); + return base::MessageLoop::current()->message_loop_proxy(); } }; @@ -170,7 +170,7 @@ class AlsaPcmOutputStreamTest : public testing::Test { StrictMock<MockAlsaWrapper> mock_alsa_wrapper_; scoped_ptr<StrictMock<MockAudioManagerLinux> > mock_manager_; - MessageLoop message_loop_; + base::MessageLoop message_loop_; scoped_refptr<media::DataBuffer> packet_; private: diff --git a/media/audio/mac/audio_device_listener_mac.cc b/media/audio/mac/audio_device_listener_mac.cc index b6eaf78..0c33d10 100644 --- a/media/audio/mac/audio_device_listener_mac.cc +++ b/media/audio/mac/audio_device_listener_mac.cc @@ -20,13 +20,14 @@ namespace media { // listener callbacks are mutually exclusive to operations on the audio thread. // TODO(dalecurtis): Instead we should replace the main thread with a dispatch // queue. See http://crbug.com/158170. -class ExclusiveDispatchQueueTaskObserver : public MessageLoop::TaskObserver { +class ExclusiveDispatchQueueTaskObserver + : public base::MessageLoop::TaskObserver { public: ExclusiveDispatchQueueTaskObserver() : property_listener_queue_(new base::mac::LibDispatchTaskRunner( "com.google.chrome.AudioPropertyListenerQueue")), queue_(property_listener_queue_->GetDispatchQueue()), - message_loop_(MessageLoop::current()) { + message_loop_(base::MessageLoop::current()) { // If we're currently on the thread, fire the suspend operation so we don't // end up with an unbalanced resume. if (message_loop_->message_loop_proxy()->BelongsToCurrentThread()) @@ -78,7 +79,7 @@ class ExclusiveDispatchQueueTaskObserver : public MessageLoop::TaskObserver { scoped_refptr<base::mac::LibDispatchTaskRunner> property_listener_queue_; const dispatch_queue_t queue_; - MessageLoop* message_loop_; + base::MessageLoop* message_loop_; DISALLOW_COPY_AND_ASSIGN(ExclusiveDispatchQueueTaskObserver); }; diff --git a/media/audio/mac/audio_device_listener_mac_unittest.cc b/media/audio/mac/audio_device_listener_mac_unittest.cc index 1f884bc..6fcc62f 100644 --- a/media/audio/mac/audio_device_listener_mac_unittest.cc +++ b/media/audio/mac/audio_device_listener_mac_unittest.cc @@ -70,7 +70,7 @@ class AudioDeviceListenerMacTest : public testing::Test { MOCK_METHOD0(OnDeviceChange, void()); protected: - MessageLoop message_loop_; + base::MessageLoop message_loop_; scoped_ptr<AudioDeviceListenerMac> output_device_listener_; DISALLOW_COPY_AND_ASSIGN(AudioDeviceListenerMacTest); diff --git a/media/audio/mac/audio_low_latency_input_mac_unittest.cc b/media/audio/mac/audio_low_latency_input_mac_unittest.cc index 55cdcee..715fc16 100644 --- a/media/audio/mac/audio_low_latency_input_mac_unittest.cc +++ b/media/audio/mac/audio_low_latency_input_mac_unittest.cc @@ -24,7 +24,7 @@ namespace media { ACTION_P3(CheckCountAndPostQuitTask, count, limit, loop) { if (++*count >= limit) { - loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } } @@ -217,7 +217,7 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamVerifyMonoRecording) { return; int count = 0; - MessageLoopForUI loop; + base::MessageLoopForUI loop; // Create an audio input stream which records in mono. AudioInputStream* ais = CreateAudioInputStream(CHANNEL_LAYOUT_MONO); @@ -252,7 +252,7 @@ TEST_F(MacAudioInputTest, AUAudioInputStreamVerifyStereoRecording) { return; int count = 0; - MessageLoopForUI loop; + base::MessageLoopForUI loop; // Create an audio input stream which records in stereo. AudioInputStream* ais = CreateAudioInputStream(CHANNEL_LAYOUT_STEREO); diff --git a/media/audio/scoped_loop_observer.cc b/media/audio/scoped_loop_observer.cc index 1332b07..01187ec 100644 --- a/media/audio/scoped_loop_observer.cc +++ b/media/audio/scoped_loop_observer.cc @@ -23,7 +23,7 @@ void ScopedLoopObserver::ObserveLoopDestruction(bool enable, base::WaitableEvent* done) { // Note: |done| may be NULL. if (loop_->BelongsToCurrentThread()) { - MessageLoop* loop = MessageLoop::current(); + base::MessageLoop* loop = base::MessageLoop::current(); if (enable) { loop->AddDestructionObserver(this); } else { diff --git a/media/audio/scoped_loop_observer.h b/media/audio/scoped_loop_observer.h index 659c68b..47cf23c 100644 --- a/media/audio/scoped_loop_observer.h +++ b/media/audio/scoped_loop_observer.h @@ -22,7 +22,7 @@ namespace media { // NOTE: The class that inherits from this class must implement the // WillDestroyCurrentMessageLoop virtual method from DestructionObserver. class ScopedLoopObserver - : public MessageLoop::DestructionObserver { + : public base::MessageLoop::DestructionObserver { public: explicit ScopedLoopObserver( const scoped_refptr<base::MessageLoopProxy>& message_loop); diff --git a/media/audio/win/audio_low_latency_input_win_unittest.cc b/media/audio/win/audio_low_latency_input_win_unittest.cc index 7f445dd..8bb73ad 100644 --- a/media/audio/win/audio_low_latency_input_win_unittest.cc +++ b/media/audio/win/audio_low_latency_input_win_unittest.cc @@ -32,7 +32,7 @@ namespace media { ACTION_P3(CheckCountAndPostQuitTask, count, limit, loop) { if (++*count >= limit) { - loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } } @@ -297,7 +297,7 @@ TEST(WinAudioInputTest, WASAPIAudioInputStreamTestPacketSizes) { return; int count = 0; - MessageLoopForUI loop; + base::MessageLoopForUI loop; // 10 ms packet size. diff --git a/media/audio/win/audio_low_latency_output_win_unittest.cc b/media/audio/win/audio_low_latency_output_win_unittest.cc index 9216072..5f1f1a6 100644 --- a/media/audio/win/audio_low_latency_output_win_unittest.cc +++ b/media/audio/win/audio_low_latency_output_win_unittest.cc @@ -58,7 +58,7 @@ MATCHER_P(HasValidDelay, value, "") { // Used to terminate a loop from a different thread than the loop belongs to. // |loop| should be a MessageLoopProxy. ACTION_P(QuitLoop, loop) { - loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } class MockAudioSourceCallback : public AudioOutputStream::AudioSourceCallback { @@ -401,7 +401,7 @@ TEST(WASAPIAudioOutputStreamTest, ValidPacketSize) { if (!CanRunAudioTests(audio_manager.get())) return; - MessageLoopForUI loop; + base::MessageLoopForUI loop; MockAudioSourceCallback source; // Create default WASAPI output stream which plays out in stereo using @@ -424,7 +424,7 @@ TEST(WASAPIAudioOutputStreamTest, ValidPacketSize) { Return(aosw.samples_per_packet()))); aos->Start(&source); - loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), TestTimeouts::action_timeout()); loop.Run(); aos->Stop(); @@ -626,7 +626,7 @@ TEST(WASAPIAudioOutputStreamTest, ExclusiveModeMinBufferSizeAt48kHz) { if (!CanRunAudioTests(audio_manager.get())) return; - MessageLoopForUI loop; + base::MessageLoopForUI loop; MockAudioSourceCallback source; // Create exclusive-mode WASAPI output stream which plays out in stereo @@ -650,7 +650,7 @@ TEST(WASAPIAudioOutputStreamTest, ExclusiveModeMinBufferSizeAt48kHz) { .WillRepeatedly(Return(aosw.samples_per_packet())); aos->Start(&source); - loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), TestTimeouts::action_timeout()); loop.Run(); aos->Stop(); @@ -667,7 +667,7 @@ TEST(WASAPIAudioOutputStreamTest, ExclusiveModeMinBufferSizeAt44kHz) { if (!CanRunAudioTests(audio_manager.get())) return; - MessageLoopForUI loop; + base::MessageLoopForUI loop; MockAudioSourceCallback source; // Create exclusive-mode WASAPI output stream which plays out in stereo @@ -691,7 +691,7 @@ TEST(WASAPIAudioOutputStreamTest, ExclusiveModeMinBufferSizeAt44kHz) { .WillRepeatedly(Return(aosw.samples_per_packet())); aos->Start(&source); - loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), TestTimeouts::action_timeout()); loop.Run(); aos->Stop(); diff --git a/media/audio/win/audio_unified_win_unittest.cc b/media/audio/win/audio_unified_win_unittest.cc index a946008..4ad02c9 100644 --- a/media/audio/win/audio_unified_win_unittest.cc +++ b/media/audio/win/audio_unified_win_unittest.cc @@ -41,7 +41,7 @@ MATCHER_P(DelayGreaterThan, value, "") { // Used to terminate a loop from a different thread than the loop belongs to. // |loop| should be a MessageLoopProxy. ACTION_P(QuitLoop, loop) { - loop->PostTask(FROM_HERE, MessageLoop::QuitClosure()); + loop->PostTask(FROM_HERE, base::MessageLoop::QuitClosure()); } class MockUnifiedSourceCallback @@ -213,7 +213,7 @@ TEST(WASAPIUnifiedStreamTest, StartLoopbackAudio) { if (!CanRunUnifiedAudioTests(audio_manager.get())) return; - MessageLoopForUI loop; + base::MessageLoopForUI loop; MockUnifiedSourceCallback source; AudioUnifiedStreamWrapper ausw(audio_manager.get()); WASAPIUnifiedStream* wus = ausw.Create(); @@ -234,7 +234,7 @@ TEST(WASAPIUnifiedStreamTest, StartLoopbackAudio) { QuitLoop(loop.message_loop_proxy()), Return(ausw.frames_per_buffer()))); wus->Start(&source); - loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), TestTimeouts::action_timeout()); loop.Run(); wus->Stop(); @@ -249,13 +249,13 @@ TEST(WASAPIUnifiedStreamTest, DISABLED_RealTimePlayThrough) { if (!CanRunUnifiedAudioTests(audio_manager.get())) return; - MessageLoopForUI loop; + base::MessageLoopForUI loop; UnifiedSourceCallback source; WASAPIUnifiedStream* wus = CreateDefaultUnifiedStream(audio_manager.get()); EXPECT_TRUE(wus->Open()); wus->Start(&source); - loop.PostDelayedTask(FROM_HERE, MessageLoop::QuitClosure(), + loop.PostDelayedTask(FROM_HERE, base::MessageLoop::QuitClosure(), base::TimeDelta::FromMilliseconds(10000)); loop.Run(); wus->Close(); |