From adabb62712f972e63fb19afc727093b2008d82ad Mon Sep 17 00:00:00 2001 From: "fischman@chromium.org" Date: Thu, 29 Sep 2011 22:36:38 +0000 Subject: Convert all of media/ over to the new base::{Bind,Callback} hotness. Mostly this was a rote conversion, replacing: - Pass-by-pointer CallbackN<>'s become pass-by-const-ref Callback<>'s. - scoped_ptr> members become Callback<> members. - several dedicated FooCallback typedefs became base::Closure. Because it was only used in a small handful of places and only in one place profitably, I deleted AutoCallbackRunner. Because it tickles a Bind bug I disabled mfdecoder in .gyp (about to get deleted in a scherkus CL). BUG=none TEST=media_tests, trybots Review URL: http://codereview.chromium.org/8071007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103376 0039d316-1c4b-4281-b951-d872f2087c98 --- media/video/capture/fake_video_capture_device.cc | 7 ++++-- .../capture/linux/video_capture_device_linux.cc | 21 ++++++++++------ media/video/capture/video_capture_proxy.cc | 29 +++++++++++----------- media/video/ffmpeg_video_decode_engine.cc | 1 - 4 files changed, 33 insertions(+), 25 deletions(-) (limited to 'media/video') diff --git a/media/video/capture/fake_video_capture_device.cc b/media/video/capture/fake_video_capture_device.cc index 9de3a40d..a74b4d3 100644 --- a/media/video/capture/fake_video_capture_device.cc +++ b/media/video/capture/fake_video_capture_device.cc @@ -6,6 +6,7 @@ #include +#include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/stringprintf.h" @@ -87,7 +88,8 @@ void FakeVideoCaptureDevice::Start() { capture_thread_.Start(); capture_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &FakeVideoCaptureDevice::OnCaptureTask)); + base::Bind(&FakeVideoCaptureDevice::OnCaptureTask, + base::Unretained(this))); } void FakeVideoCaptureDevice::Stop() { @@ -121,7 +123,8 @@ void FakeVideoCaptureDevice::OnCaptureTask() { // Reschedule next CaptureTask. capture_thread_.message_loop()->PostDelayedTask( FROM_HERE, - NewRunnableMethod(this, &FakeVideoCaptureDevice::OnCaptureTask), + base::Bind(&FakeVideoCaptureDevice::OnCaptureTask, + base::Unretained(this)), kFakeCaptureTimeoutMs); } diff --git a/media/video/capture/linux/video_capture_device_linux.cc b/media/video/capture/linux/video_capture_device_linux.cc index 3062e6e..c70ba3c 100644 --- a/media/video/capture/linux/video_capture_device_linux.cc +++ b/media/video/capture/linux/video_capture_device_linux.cc @@ -12,6 +12,7 @@ #include +#include "base/bind.h" #include "base/file_util.h" #include "base/stringprintf.h" @@ -142,8 +143,8 @@ void VideoCaptureDeviceLinux::Allocate(int width, v4l2_thread_.Start(); v4l2_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureDeviceLinux::OnAllocate, - width, height, frame_rate, observer)); + base::Bind(&VideoCaptureDeviceLinux::OnAllocate, base::Unretained(this), + width, height, frame_rate, observer)); } void VideoCaptureDeviceLinux::Start() { @@ -152,7 +153,7 @@ void VideoCaptureDeviceLinux::Start() { } v4l2_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureDeviceLinux::OnStart)); + base::Bind(&VideoCaptureDeviceLinux::OnStart, base::Unretained(this))); } void VideoCaptureDeviceLinux::Stop() { @@ -161,7 +162,7 @@ void VideoCaptureDeviceLinux::Stop() { } v4l2_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureDeviceLinux::OnStop)); + base::Bind(&VideoCaptureDeviceLinux::OnStop, base::Unretained(this))); } void VideoCaptureDeviceLinux::DeAllocate() { @@ -170,7 +171,8 @@ void VideoCaptureDeviceLinux::DeAllocate() { } v4l2_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureDeviceLinux::OnDeAllocate)); + base::Bind(&VideoCaptureDeviceLinux::OnDeAllocate, + base::Unretained(this))); v4l2_thread_.Stop(); // Make sure no buffers are still allocated. @@ -297,7 +299,8 @@ void VideoCaptureDeviceLinux::OnStart() { // Post task to start fetching frames from v4l2. v4l2_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureDeviceLinux::OnCaptureTask)); + base::Bind(&VideoCaptureDeviceLinux::OnCaptureTask, + base::Unretained(this))); } void VideoCaptureDeviceLinux::OnStop() { @@ -342,7 +345,8 @@ void VideoCaptureDeviceLinux::OnCaptureTask() { } v4l2_thread_.message_loop()->PostDelayedTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureDeviceLinux::OnCaptureTask), + base::Bind(&VideoCaptureDeviceLinux::OnCaptureTask, + base::Unretained(this)), kCaptureSelectWaitMs); } @@ -368,7 +372,8 @@ void VideoCaptureDeviceLinux::OnCaptureTask() { v4l2_thread_.message_loop()->PostTask( FROM_HERE, - NewRunnableMethod(this, &VideoCaptureDeviceLinux::OnCaptureTask)); + base::Bind(&VideoCaptureDeviceLinux::OnCaptureTask, + base::Unretained(this))); } bool VideoCaptureDeviceLinux::AllocateVideoBuffers() { diff --git a/media/video/capture/video_capture_proxy.cc b/media/video/capture/video_capture_proxy.cc index 221f2c6..463d77f 100644 --- a/media/video/capture/video_capture_proxy.cc +++ b/media/video/capture/video_capture_proxy.cc @@ -4,6 +4,7 @@ #include "media/video/capture/video_capture_proxy.h" +#include "base/bind.h" #include "base/location.h" #include "base/message_loop_proxy.h" @@ -36,42 +37,42 @@ VideoCaptureHandlerProxy::~VideoCaptureHandlerProxy() { } void VideoCaptureHandlerProxy::OnStarted(VideoCapture* capture) { - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, + main_message_loop_->PostTask(FROM_HERE, base::Bind( &VideoCaptureHandlerProxy::OnStartedOnMainThread, + base::Unretained(this), capture, GetState(capture))); } void VideoCaptureHandlerProxy::OnStopped(VideoCapture* capture) { - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, + main_message_loop_->PostTask(FROM_HERE, base::Bind( &VideoCaptureHandlerProxy::OnStoppedOnMainThread, + base::Unretained(this), capture, GetState(capture))); } void VideoCaptureHandlerProxy::OnPaused(VideoCapture* capture) { - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, + main_message_loop_->PostTask(FROM_HERE, base::Bind( &VideoCaptureHandlerProxy::OnPausedOnMainThread, + base::Unretained(this), capture, GetState(capture))); } void VideoCaptureHandlerProxy::OnError(VideoCapture* capture, int error_code) { - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, + main_message_loop_->PostTask(FROM_HERE, base::Bind( &VideoCaptureHandlerProxy::OnErrorOnMainThread, + base::Unretained(this), capture, GetState(capture), error_code)); } void VideoCaptureHandlerProxy::OnRemoved(VideoCapture* capture) { - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, + main_message_loop_->PostTask(FROM_HERE, base::Bind( &VideoCaptureHandlerProxy::OnRemovedOnMainThread, + base::Unretained(this), capture, GetState(capture))); } @@ -79,9 +80,9 @@ void VideoCaptureHandlerProxy::OnRemoved(VideoCapture* capture) { void VideoCaptureHandlerProxy::OnBufferReady( VideoCapture* capture, scoped_refptr buffer) { - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, + main_message_loop_->PostTask(FROM_HERE, base::Bind( &VideoCaptureHandlerProxy::OnBufferReadyOnMainThread, + base::Unretained(this), capture, GetState(capture), buffer)); @@ -90,9 +91,9 @@ void VideoCaptureHandlerProxy::OnBufferReady( void VideoCaptureHandlerProxy::OnDeviceInfoReceived( VideoCapture* capture, const VideoCaptureParams& device_info) { - main_message_loop_->PostTask(FROM_HERE, NewRunnableMethod( - this, + main_message_loop_->PostTask(FROM_HERE, base::Bind( &VideoCaptureHandlerProxy::OnDeviceInfoReceivedOnMainThread, + base::Unretained(this), capture, GetState(capture), device_info)); diff --git a/media/video/ffmpeg_video_decode_engine.cc b/media/video/ffmpeg_video_decode_engine.cc index 65edc2f..9a89262 100644 --- a/media/video/ffmpeg_video_decode_engine.cc +++ b/media/video/ffmpeg_video_decode_engine.cc @@ -8,7 +8,6 @@ #include "base/string_number_conversions.h" #include "base/task.h" #include "media/base/buffers.h" -#include "media/base/callback.h" #include "media/base/limits.h" #include "media/base/media_switches.h" #include "media/base/pipeline.h" -- cgit v1.1