diff options
author | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 02:37:54 +0000 |
---|---|---|
committer | wjia@chromium.org <wjia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-07 02:37:54 +0000 |
commit | 5aef3d38c7c0d58470996906591fb697bd6468f6 (patch) | |
tree | f2cc27f382253992275c07e88ab11c52c7fc494a /content/renderer | |
parent | 7fec32c72497c23feb9419c14df17d4cf4dbb08b (diff) | |
download | chromium_src-5aef3d38c7c0d58470996906591fb697bd6468f6.zip chromium_src-5aef3d38c7c0d58470996906591fb697bd6468f6.tar.gz chromium_src-5aef3d38c7c0d58470996906591fb697bd6468f6.tar.bz2 |
remove NewRunnableMethod and switch to base::Bind
BUG=none
TEST=trybots
Review URL: http://codereview.chromium.org/8175013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104433 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer')
-rw-r--r-- | content/renderer/media/audio_device.cc | 9 | ||||
-rw-r--r-- | content/renderer/media/audio_input_device.cc | 13 | ||||
-rw-r--r-- | content/renderer/media/audio_input_message_filter.cc | 4 | ||||
-rw-r--r-- | content/renderer/media/audio_message_filter.cc | 4 | ||||
-rw-r--r-- | content/renderer/media/audio_renderer_impl.cc | 21 | ||||
-rw-r--r-- | content/renderer/media/audio_renderer_impl_unittest.cc | 41 | ||||
-rw-r--r-- | content/renderer/media/capture_video_decoder.cc | 45 | ||||
-rw-r--r-- | content/renderer/media/render_media_log.cc | 3 | ||||
-rw-r--r-- | content/renderer/media/rtc_video_decoder.cc | 26 | ||||
-rw-r--r-- | content/renderer/media/video_capture_impl.cc | 46 | ||||
-rw-r--r-- | content/renderer/media/video_capture_impl.h | 4 | ||||
-rw-r--r-- | content/renderer/media/video_capture_impl_manager.cc | 5 | ||||
-rw-r--r-- | content/renderer/media/video_capture_module_impl.cc | 18 | ||||
-rw-r--r-- | content/renderer/media/webrtc_audio_device_impl.cc | 6 |
14 files changed, 122 insertions, 123 deletions
diff --git a/content/renderer/media/audio_device.cc b/content/renderer/media/audio_device.cc index 1667950..7f007da 100644 --- a/content/renderer/media/audio_device.cc +++ b/content/renderer/media/audio_device.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/audio_device.h" +#include "base/bind.h" #include "base/debug/trace_event.h" #include "base/message_loop.h" #include "base/time.h" @@ -51,7 +52,7 @@ void AudioDevice::Start() { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioDevice::InitializeOnIOThread, params)); + base::Bind(&AudioDevice::InitializeOnIOThread, this, params)); } bool AudioDevice::Stop() { @@ -64,7 +65,7 @@ bool AudioDevice::Stop() { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioDevice::ShutDownOnIOThread, &completion)); + base::Bind(&AudioDevice::ShutDownOnIOThread, this, &completion)); // We wait here for the IO task to be completed to remove race conflicts // with OnLowLatencyCreated() and to ensure that Stop() acts as a synchronous @@ -89,7 +90,7 @@ bool AudioDevice::SetVolume(double volume) { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioDevice::SetVolumeOnIOThread, volume)); + base::Bind(&AudioDevice::SetVolumeOnIOThread, this, volume)); volume_ = volume; @@ -190,7 +191,7 @@ void AudioDevice::OnLowLatencyCreated( MessageLoop::current()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioDevice::StartOnIOThread)); + base::Bind(&AudioDevice::StartOnIOThread, this)); } void AudioDevice::OnVolume(double volume) { diff --git a/content/renderer/media/audio_input_device.cc b/content/renderer/media/audio_input_device.cc index 2c32d45..0dd06b8 100644 --- a/content/renderer/media/audio_input_device.cc +++ b/content/renderer/media/audio_input_device.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/audio_input_device.h" +#include "base/bind.h" #include "base/message_loop.h" #include "base/time.h" #include "content/common/child_process.h" @@ -54,15 +55,15 @@ void AudioInputDevice::Start() { VLOG(1) << "Start()"; ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioInputDevice::InitializeOnIOThread)); + base::Bind(&AudioInputDevice::InitializeOnIOThread, this)); } void AudioInputDevice::SetDevice(int session_id) { VLOG(1) << "SetDevice (session_id=" << session_id << ")"; ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioInputDevice::SetSessionIdOnIOThread, - session_id)); + base::Bind(&AudioInputDevice::SetSessionIdOnIOThread, this, + session_id)); } bool AudioInputDevice::Stop() { @@ -76,8 +77,8 @@ bool AudioInputDevice::Stop() { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioInputDevice::ShutDownOnIOThread, - &completion)); + base::Bind(&AudioInputDevice::ShutDownOnIOThread, this, + &completion)); // We wait here for the IO task to be completed to remove race conflicts // with OnLowLatencyCreated() and to ensure that Stop() acts as a synchronous @@ -198,7 +199,7 @@ void AudioInputDevice::OnLowLatencyCreated( MessageLoop::current()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioInputDevice::StartOnIOThread)); + base::Bind(&AudioInputDevice::StartOnIOThread, this)); } void AudioInputDevice::OnVolume(double volume) { diff --git a/content/renderer/media/audio_input_message_filter.cc b/content/renderer/media/audio_input_message_filter.cc index 4f8c8ba..f84e8cc 100644 --- a/content/renderer/media/audio_input_message_filter.cc +++ b/content/renderer/media/audio_input_message_filter.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/audio_input_message_filter.h" +#include "base/bind.h" #include "base/message_loop.h" #include "base/time.h" #include "content/common/child_process.h" @@ -30,7 +31,8 @@ bool AudioInputMessageFilter::Send(IPC::Message* message) { // safe. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioInputMessageFilter::Send, message)); + base::IgnoreReturn<bool>(base::Bind(&AudioInputMessageFilter::Send, + this, message))); return true; } diff --git a/content/renderer/media/audio_message_filter.cc b/content/renderer/media/audio_message_filter.cc index b10cf30..628ea8d 100644 --- a/content/renderer/media/audio_message_filter.cc +++ b/content/renderer/media/audio_message_filter.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/audio_message_filter.h" +#include "base/bind.h" #include "base/message_loop.h" #include "base/time.h" #include "content/common/child_process.h" @@ -30,7 +31,8 @@ bool AudioMessageFilter::Send(IPC::Message* message) { // safe. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioMessageFilter::Send, message)); + base::IgnoreReturn<bool>(base::Bind(&AudioMessageFilter::Send, + this, message))); return true; } diff --git a/content/renderer/media/audio_renderer_impl.cc b/content/renderer/media/audio_renderer_impl.cc index 38e5ee59..754b7e0 100644 --- a/content/renderer/media/audio_renderer_impl.cc +++ b/content/renderer/media/audio_renderer_impl.cc @@ -8,6 +8,7 @@ #include <algorithm> +#include "base/bind.h" #include "base/command_line.h" #include "content/common/child_process.h" #include "content/common/content_switches.h" @@ -93,7 +94,7 @@ bool AudioRendererImpl::OnInitialize(int bits_per_channel, ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::CreateStreamTask, params)); + base::Bind(&AudioRendererImpl::CreateStreamTask, this, params)); return true; } @@ -105,7 +106,7 @@ void AudioRendererImpl::OnStop() { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::DestroyTask)); + base::Bind(&AudioRendererImpl::DestroyTask, this)); if (audio_thread_.get()) { socket_->Close(); @@ -118,7 +119,7 @@ void AudioRendererImpl::NotifyDataAvailableIfNecessary() { // Post a task to render thread to notify a packet reception. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::NotifyPacketReadyTask)); + base::Bind(&AudioRendererImpl::NotifyPacketReadyTask, this)); } } @@ -152,12 +153,12 @@ void AudioRendererImpl::SetPlaybackRate(float rate) { if (GetPlaybackRate() == 0.0f && rate != 0.0f) { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::PlayTask)); + base::Bind(&AudioRendererImpl::PlayTask, this)); } else if (GetPlaybackRate() != 0.0f && rate == 0.0f) { // Pause is easy, we can always pause. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::PauseTask)); + base::Bind(&AudioRendererImpl::PauseTask, this)); } AudioRendererBase::SetPlaybackRate(rate); @@ -176,7 +177,7 @@ void AudioRendererImpl::Pause(const base::Closure& callback) { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::PauseTask)); + base::Bind(&AudioRendererImpl::PauseTask, this)); } void AudioRendererImpl::Seek(base::TimeDelta time, @@ -188,7 +189,7 @@ void AudioRendererImpl::Seek(base::TimeDelta time, ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::SeekTask)); + base::Bind(&AudioRendererImpl::SeekTask, this)); } @@ -201,11 +202,11 @@ void AudioRendererImpl::Play(const base::Closure& callback) { if (GetPlaybackRate() != 0.0f) { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::PlayTask)); + base::Bind(&AudioRendererImpl::PlayTask, this)); } else { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::PauseTask)); + base::Bind(&AudioRendererImpl::PauseTask, this)); } } @@ -215,7 +216,7 @@ void AudioRendererImpl::SetVolume(float volume) { return; ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &AudioRendererImpl::SetVolumeTask, volume)); + base::Bind(&AudioRendererImpl::SetVolumeTask, this, volume)); } void AudioRendererImpl::OnCreated(base::SharedMemoryHandle handle, diff --git a/content/renderer/media/audio_renderer_impl_unittest.cc b/content/renderer/media/audio_renderer_impl_unittest.cc index a1cdb73..9ddb77e 100644 --- a/content/renderer/media/audio_renderer_impl_unittest.cc +++ b/content/renderer/media/audio_renderer_impl_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/bind.h" #include "base/message_loop.h" #include "base/process_util.h" #include "base/synchronization/waitable_event.h" @@ -183,8 +184,8 @@ class AudioRendererImplTest // as all AudioMessageFilter::Delegate methods. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::OnCreated, duplicated_handle, kSize)); + base::Bind(&DelegateCaller::OnCreated, delegate_caller_.get(), + duplicated_handle, kSize)); WaitForIOThreadCompletion(); } @@ -254,29 +255,29 @@ TEST_F(AudioRendererImplTest, Stop) { if (renderer_->latency_type() == AudioRendererImpl::kHighLatency) { ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::OnRequestPacket, AudioBuffersState(kSize, 0))); + base::Bind(&DelegateCaller::OnRequestPacket, + delegate_caller_.get(), AudioBuffersState(kSize, 0))); } ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::OnStateChanged, kAudioStreamError)); + base::Bind(&DelegateCaller::OnStateChanged, + delegate_caller_.get(), kAudioStreamError)); ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::OnStateChanged, kAudioStreamPlaying)); + base::Bind(&DelegateCaller::OnStateChanged, + delegate_caller_.get(), kAudioStreamPlaying)); ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::OnStateChanged, kAudioStreamPaused)); + base::Bind(&DelegateCaller::OnStateChanged, + delegate_caller_.get(), kAudioStreamPaused)); ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::OnCreated, shared_mem_.handle(), kSize)); + base::Bind(&DelegateCaller::OnCreated, + delegate_caller_.get(), shared_mem_.handle(), kSize)); ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::OnVolume, 0.5)); + base::Bind(&DelegateCaller::OnVolume, + delegate_caller_.get(), 0.5)); WaitForIOThreadCompletion(); @@ -290,8 +291,8 @@ TEST_F(AudioRendererImplTest, DestroyedMessageLoop_SetPlaybackRate) { // still works. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::DestroyCurrentMessageLoop)); + base::Bind(&DelegateCaller::DestroyCurrentMessageLoop, + delegate_caller_.get())); WaitForIOThreadCompletion(); // No tasks will be posted on the IO thread here since we are in @@ -307,8 +308,8 @@ TEST_F(AudioRendererImplTest, DestroyedMessageLoop_SetVolume) { // still works. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::DestroyCurrentMessageLoop)); + base::Bind(&DelegateCaller::DestroyCurrentMessageLoop, + delegate_caller_.get())); WaitForIOThreadCompletion(); // No tasks will be posted on the IO thread here since we are in @@ -322,8 +323,8 @@ TEST_F(AudioRendererImplTest, DestroyedMessageLoop_ConsumeAudioSamples) { // still works. ChildProcess::current()->io_message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(delegate_caller_.get(), - &DelegateCaller::DestroyCurrentMessageLoop)); + base::Bind(&DelegateCaller::DestroyCurrentMessageLoop, + delegate_caller_.get())); WaitForIOThreadCompletion(); // No tasks will be posted on the IO thread here since we are in diff --git a/content/renderer/media/capture_video_decoder.cc b/content/renderer/media/capture_video_decoder.cc index 4a356a1..fadcac7 100644 --- a/content/renderer/media/capture_video_decoder.cc +++ b/content/renderer/media/capture_video_decoder.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/capture_video_decoder.h" +#include "base/bind.h" #include "content/renderer/media/video_capture_impl_manager.h" #include "media/base/filter_host.h" #include "media/base/limits.h" @@ -35,19 +36,17 @@ void CaptureVideoDecoder::Initialize( const media::StatisticsCallback& stat_callback) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &CaptureVideoDecoder::InitializeOnDecoderThread, - make_scoped_refptr(demuxer_stream), - filter_callback, stat_callback)); + base::Bind(&CaptureVideoDecoder::InitializeOnDecoderThread, + this, make_scoped_refptr(demuxer_stream), + filter_callback, stat_callback)); } void CaptureVideoDecoder::ProduceVideoFrame( scoped_refptr<media::VideoFrame> video_frame) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod( - this, - &CaptureVideoDecoder::ProduceVideoFrameOnDecoderThread, video_frame)); + base::Bind(&CaptureVideoDecoder::ProduceVideoFrameOnDecoderThread, + this, video_frame)); } gfx::Size CaptureVideoDecoder::natural_size() { @@ -57,35 +56,30 @@ gfx::Size CaptureVideoDecoder::natural_size() { void CaptureVideoDecoder::Play(const base::Closure& callback) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &CaptureVideoDecoder::PlayOnDecoderThread, - callback)); + base::Bind(&CaptureVideoDecoder::PlayOnDecoderThread, + this, callback)); } void CaptureVideoDecoder::Pause(const base::Closure& callback) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &CaptureVideoDecoder::PauseOnDecoderThread, - callback)); + base::Bind(&CaptureVideoDecoder::PauseOnDecoderThread, + this, callback)); } void CaptureVideoDecoder::Stop(const base::Closure& callback) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &CaptureVideoDecoder::StopOnDecoderThread, - callback)); + base::Bind(&CaptureVideoDecoder::StopOnDecoderThread, + this, callback)); } void CaptureVideoDecoder::Seek(base::TimeDelta time, const media::FilterStatusCB& cb) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &CaptureVideoDecoder::SeekOnDecoderThread, - time, - cb)); + base::Bind(&CaptureVideoDecoder::SeekOnDecoderThread, + this, time, cb)); } void CaptureVideoDecoder::OnStarted(media::VideoCapture* capture) { @@ -95,9 +89,8 @@ void CaptureVideoDecoder::OnStarted(media::VideoCapture* capture) { void CaptureVideoDecoder::OnStopped(media::VideoCapture* capture) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &CaptureVideoDecoder::OnStoppedOnDecoderThread, - capture)); + base::Bind(&CaptureVideoDecoder::OnStoppedOnDecoderThread, + this, capture)); } void CaptureVideoDecoder::OnPaused(media::VideoCapture* capture) { @@ -119,10 +112,8 @@ void CaptureVideoDecoder::OnBufferReady( DCHECK(buf); message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &CaptureVideoDecoder::OnBufferReadyOnDecoderThread, - capture, - buf)); + base::Bind(&CaptureVideoDecoder::OnBufferReadyOnDecoderThread, + this, capture, buf)); } void CaptureVideoDecoder::OnDeviceInfoReceived( diff --git a/content/renderer/media/render_media_log.cc b/content/renderer/media/render_media_log.cc index ae2c81f..b5d701f 100644 --- a/content/renderer/media/render_media_log.cc +++ b/content/renderer/media/render_media_log.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/render_media_log.h" +#include "base/bind.h" #include "base/message_loop_proxy.h" #include "content/common/view_messages.h" #include "content/renderer/render_thread_impl.h" @@ -21,7 +22,7 @@ void RenderMediaLog::AddEvent(media::MediaLogEvent* event) { RenderThreadImpl::current()->Send(new ViewHostMsg_MediaLogEvent(*e)); } else { render_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &RenderMediaLog::AddEvent, e.release())); + base::Bind(&RenderMediaLog::AddEvent, this, e.release())); } } diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc index ef9973c..a2a5784 100644 --- a/content/renderer/media/rtc_video_decoder.cc +++ b/content/renderer/media/rtc_video_decoder.cc @@ -68,9 +68,8 @@ void RTCVideoDecoder::Initialize(DemuxerStream* demuxer_stream, void RTCVideoDecoder::Play(const base::Closure& callback) { if (MessageLoop::current() != message_loop_) { message_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, - &RTCVideoDecoder::Play, - callback)); + base::Bind(&RTCVideoDecoder::Play, + this, callback)); return; } @@ -82,9 +81,8 @@ void RTCVideoDecoder::Play(const base::Closure& callback) { void RTCVideoDecoder::Pause(const base::Closure& callback) { if (MessageLoop::current() != message_loop_) { message_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, - &RTCVideoDecoder::Pause, - callback)); + base::Bind(&RTCVideoDecoder::Pause, + this, callback)); return; } @@ -98,9 +96,8 @@ void RTCVideoDecoder::Pause(const base::Closure& callback) { void RTCVideoDecoder::Stop(const base::Closure& callback) { if (MessageLoop::current() != message_loop_) { message_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, - &RTCVideoDecoder::Stop, - callback)); + base::Bind(&RTCVideoDecoder::Stop, + this, callback)); return; } @@ -114,8 +111,8 @@ void RTCVideoDecoder::Stop(const base::Closure& callback) { void RTCVideoDecoder::Seek(base::TimeDelta time, const FilterStatusCB& cb) { if (MessageLoop::current() != message_loop_) { message_loop_->PostTask(FROM_HERE, - NewRunnableMethod(this, &RTCVideoDecoder::Seek, - time, cb)); + base::Bind(&RTCVideoDecoder::Seek, this, + time, cb)); return; } @@ -139,8 +136,7 @@ void RTCVideoDecoder::ProduceVideoFrame( if (MessageLoop::current() != message_loop_) { message_loop_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &RTCVideoDecoder::ProduceVideoFrame, video_frame)); + base::Bind(&RTCVideoDecoder::ProduceVideoFrame, this, video_frame)); return; } DCHECK_EQ(MessageLoop::current(), message_loop_); @@ -208,9 +204,7 @@ bool RTCVideoDecoder::RenderFrame(const cricket::VideoFrame* frame) { if (MessageLoop::current() != message_loop_) { message_loop_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &RTCVideoDecoder::VideoFrameReady, - video_frame)); + base::Bind(&RTCVideoDecoder::VideoFrameReady, this, video_frame)); } else { VideoFrameReady(video_frame); } diff --git a/content/renderer/media/video_capture_impl.cc b/content/renderer/media/video_capture_impl.cc index 4cca466..6941162 100644 --- a/content/renderer/media/video_capture_impl.cc +++ b/content/renderer/media/video_capture_impl.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/video_capture_impl.h" +#include "base/bind.h" #include "base/stl_util.h" #include "content/common/child_process.h" #include "content/common/media/video_capture_messages.h" @@ -61,14 +62,15 @@ void VideoCaptureImpl::Init() { if (!io_message_loop_proxy->BelongsToCurrentThread()) { io_message_loop_proxy->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::AddDelegateOnIOThread)); + base::Bind(&VideoCaptureImpl::AddDelegateOnIOThread, + base::Unretained(this))); return; } AddDelegateOnIOThread(); } -void VideoCaptureImpl::DeInit(Task* task) { +void VideoCaptureImpl::DeInit(base::Closure task) { if (state_ == kStarted) Send(new VideoCaptureHostMsg_Stop(device_id_)); @@ -77,8 +79,8 @@ void VideoCaptureImpl::DeInit(Task* task) { if (!io_message_loop_proxy->BelongsToCurrentThread()) { io_message_loop_proxy->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::RemoveDelegateOnIOThread, - task)); + base::Bind(&VideoCaptureImpl::RemoveDelegateOnIOThread, + base::Unretained(this), task)); return; } @@ -91,49 +93,53 @@ void VideoCaptureImpl::StartCapture( DCHECK_EQ(capability.raw_type, media::VideoFrame::I420); ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoStartCapture, handler, - capability)); + base::Bind(&VideoCaptureImpl::DoStartCapture, + base::Unretained(this), handler, capability)); } void VideoCaptureImpl::StopCapture(media::VideoCapture::EventHandler* handler) { ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoStopCapture, handler)); + base::Bind(&VideoCaptureImpl::DoStopCapture, + base::Unretained(this), handler)); } void VideoCaptureImpl::FeedBuffer(scoped_refptr<VideoFrameBuffer> buffer) { ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoFeedBuffer, buffer)); + base::Bind(&VideoCaptureImpl::DoFeedBuffer, + base::Unretained(this), buffer)); } void VideoCaptureImpl::OnBufferCreated( base::SharedMemoryHandle handle, int length, int buffer_id) { ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoBufferCreated, - handle, length, buffer_id)); + base::Bind(&VideoCaptureImpl::DoBufferCreated, + base::Unretained(this), handle, length, buffer_id)); } void VideoCaptureImpl::OnBufferReceived(int buffer_id, base::Time timestamp) { ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoBufferReceived, - buffer_id, timestamp)); + base::Bind(&VideoCaptureImpl::DoBufferReceived, + base::Unretained(this), buffer_id, timestamp)); } void VideoCaptureImpl::OnStateChanged(const media::VideoCapture::State& state) { ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoStateChanged, state)); + base::Bind(&VideoCaptureImpl::DoStateChanged, + base::Unretained(this), state)); } void VideoCaptureImpl::OnDeviceInfoReceived( const media::VideoCaptureParams& device_info) { ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoDeviceInfoReceived, - device_info)); + base::Bind(&VideoCaptureImpl::DoDeviceInfoReceived, + base::Unretained(this), device_info)); } void VideoCaptureImpl::OnDelegateAdded(int32 device_id) { ml_proxy_->PostTask(FROM_HERE, - NewRunnableMethod(this, &VideoCaptureImpl::DoDelegateAdded, device_id)); + base::Bind(&VideoCaptureImpl::DoDelegateAdded, + base::Unretained(this), device_id)); } void VideoCaptureImpl::DoStartCapture( @@ -453,8 +459,8 @@ void VideoCaptureImpl::AddDelegateOnIOThread() { message_filter_->AddDelegate(this); } -void VideoCaptureImpl::RemoveDelegateOnIOThread(Task* task) { - base::ScopedTaskRunner task_runner(task); +void VideoCaptureImpl::RemoveDelegateOnIOThread(base::Closure task) { + base::ScopedClosureRunner task_runner(task); message_filter_->RemoveDelegate(this); } @@ -463,8 +469,8 @@ void VideoCaptureImpl::Send(IPC::Message* message) { ChildProcess::current()->io_message_loop_proxy(); io_message_loop_proxy->PostTask(FROM_HERE, - NewRunnableMethod(message_filter_.get(), - &VideoCaptureMessageFilter::Send, message)); + base::IgnoreReturn<bool>(base::Bind(&VideoCaptureMessageFilter::Send, + message_filter_.get(), message))); } bool VideoCaptureImpl::CapabilityMatchesParameters( diff --git a/content/renderer/media/video_capture_impl.h b/content/renderer/media/video_capture_impl.h index a250eb0..e2a224b 100644 --- a/content/renderer/media/video_capture_impl.h +++ b/content/renderer/media/video_capture_impl.h @@ -79,12 +79,12 @@ class CONTENT_EXPORT VideoCaptureImpl void DoDelegateAdded(int32 device_id); void Init(); - void DeInit(Task* task); + void DeInit(base::Closure task); void StopDevice(); void RestartCapture(); void StartCaptureInternal(); void AddDelegateOnIOThread(); - void RemoveDelegateOnIOThread(Task* task); + void RemoveDelegateOnIOThread(base::Closure task); virtual void Send(IPC::Message* message); // Helpers. diff --git a/content/renderer/media/video_capture_impl_manager.cc b/content/renderer/media/video_capture_impl_manager.cc index ca5e011..5b5de3d 100644 --- a/content/renderer/media/video_capture_impl_manager.cc +++ b/content/renderer/media/video_capture_impl_manager.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/video_capture_impl_manager.h" +#include "base/bind.h" #include "base/stl_util.h" #include "content/renderer/media/video_capture_impl.h" #include "content/renderer/media/video_capture_message_filter.h" @@ -55,8 +56,8 @@ void VideoCaptureImplManager::RemoveDevice( if (size == it->second->clients.size() || size > 1) return; - devices_[id]->vc->DeInit(NewRunnableMethod(this, - &VideoCaptureImplManager::FreeDevice, devices_[id]->vc)); + devices_[id]->vc->DeInit(base::Bind(&VideoCaptureImplManager::FreeDevice, + this, devices_[id]->vc)); delete devices_[id]; devices_.erase(id); } diff --git a/content/renderer/media/video_capture_module_impl.cc b/content/renderer/media/video_capture_module_impl.cc index e1b8b6f..08123d7 100644 --- a/content/renderer/media/video_capture_module_impl.cc +++ b/content/renderer/media/video_capture_module_impl.cc @@ -5,6 +5,7 @@ #include "content/renderer/media/video_capture_module_impl.h" #include "base/atomicops.h" +#include "base/bind.h" #include "content/renderer/media/video_capture_impl_manager.h" VideoCaptureModuleImpl::VideoCaptureModuleImpl( @@ -57,17 +58,15 @@ WebRtc_Word32 VideoCaptureModuleImpl::StartCapture( const webrtc::VideoCaptureCapability& capability) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &VideoCaptureModuleImpl::StartCaptureOnCaptureThread, - capability)); + base::Bind(&VideoCaptureModuleImpl::StartCaptureOnCaptureThread, + this, capability)); return 0; } WebRtc_Word32 VideoCaptureModuleImpl::StopCapture() { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &VideoCaptureModuleImpl::StopCaptureOnCaptureThread)); + base::Bind(&VideoCaptureModuleImpl::StopCaptureOnCaptureThread, this)); return 0; } @@ -92,8 +91,8 @@ void VideoCaptureModuleImpl::OnStarted(media::VideoCapture* capture) { void VideoCaptureModuleImpl::OnStopped(media::VideoCapture* capture) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureModuleImpl::OnStoppedOnCaptureThread, - capture)); + base::Bind(&VideoCaptureModuleImpl::OnStoppedOnCaptureThread, this, + capture)); } void VideoCaptureModuleImpl::OnPaused(media::VideoCapture* capture) { @@ -114,9 +113,8 @@ void VideoCaptureModuleImpl::OnBufferReady( scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf) { message_loop_proxy_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &VideoCaptureModuleImpl::OnBufferReadyOnCaptureThread, - capture, buf)); + base::Bind(&VideoCaptureModuleImpl::OnBufferReadyOnCaptureThread, + this, capture, buf)); } void VideoCaptureModuleImpl::OnDeviceInfoReceived( diff --git a/content/renderer/media/webrtc_audio_device_impl.cc b/content/renderer/media/webrtc_audio_device_impl.cc index d467476..748a890 100644 --- a/content/renderer/media/webrtc_audio_device_impl.cc +++ b/content/renderer/media/webrtc_audio_device_impl.cc @@ -4,6 +4,7 @@ #include "content/renderer/media/webrtc_audio_device_impl.h" +#include "base/bind.h" #include "base/string_util.h" #include "content/renderer/render_thread_impl.h" #include "media/audio/audio_util.h" @@ -258,9 +259,8 @@ int32_t WebRtcAudioDeviceImpl::Init() { // the audio clients can only be created on this thread. render_loop_->PostTask( FROM_HERE, - NewRunnableMethod(this, - &WebRtcAudioDeviceImpl::InitOnRenderThread, - &error, &event)); + base::Bind(&WebRtcAudioDeviceImpl::InitOnRenderThread, + this, &error, &event)); event.Wait(); return error; } |