| Index: content/browser/media/capture/content_video_capture_device_core.cc
|
| diff --git a/content/browser/media/capture/content_video_capture_device_core.cc b/content/browser/media/capture/content_video_capture_device_core.cc
|
| index 8d44104c1c418f4a3f21d9648b682d4a34ce74d7..437c2aa926c188e33691669e795e49aaaf4eb7b9 100644
|
| --- a/content/browser/media/capture/content_video_capture_device_core.cc
|
| +++ b/content/browser/media/capture/content_video_capture_device_core.cc
|
| @@ -21,7 +21,6 @@
|
| #include "base/threading/thread_checker.h"
|
| #include "base/time/time.h"
|
| #include "base/trace_event/trace_event.h"
|
| -#include "content/public/browser/browser_thread.h"
|
| #include "media/base/bind_to_current_loop.h"
|
| #include "media/base/video_capture_types.h"
|
| #include "media/base/video_frame.h"
|
| @@ -33,10 +32,8 @@ namespace content {
|
|
|
| namespace {
|
|
|
| -void DeleteCaptureMachineOnUIThread(
|
| +void DeleteCaptureMachine(
|
| scoped_ptr<VideoCaptureMachine> capture_machine) {
|
| - DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
| -
|
| capture_machine.reset();
|
| }
|
|
|
| @@ -251,15 +248,9 @@ void ContentVideoCaptureDeviceCore::AllocateAndStart(
|
| MakeEven(params.requested_format.frame_size.height()));
|
|
|
| oracle_proxy_ = new ThreadSafeCaptureOracle(client.Pass(), new_params);
|
| -
|
| - // Starts the capture machine asynchronously.
|
| - BrowserThread::PostTaskAndReplyWithResult(
|
| - BrowserThread::UI,
|
| - FROM_HERE,
|
| - base::Bind(&VideoCaptureMachine::Start,
|
| - base::Unretained(capture_machine_.get()),
|
| - oracle_proxy_,
|
| - new_params),
|
| + capture_machine_->Start(
|
| + oracle_proxy_,
|
| + new_params,
|
| base::Bind(&ContentVideoCaptureDeviceCore::CaptureStarted, AsWeakPtr()));
|
|
|
| TransitionStateTo(kCapturing);
|
| @@ -276,12 +267,7 @@ void ContentVideoCaptureDeviceCore::StopAndDeAllocate() {
|
|
|
| TransitionStateTo(kIdle);
|
|
|
| - // Stops the capture machine asynchronously.
|
| - BrowserThread::PostTask(
|
| - BrowserThread::UI, FROM_HERE, base::Bind(
|
| - &VideoCaptureMachine::Stop,
|
| - base::Unretained(capture_machine_.get()),
|
| - base::Bind(&base::DoNothing)));
|
| + capture_machine_->Stop(base::Bind(&base::DoNothing));
|
| }
|
|
|
| void ContentVideoCaptureDeviceCore::CaptureStarted(bool success) {
|
| @@ -303,16 +289,11 @@ ContentVideoCaptureDeviceCore::ContentVideoCaptureDeviceCore(
|
| ContentVideoCaptureDeviceCore::~ContentVideoCaptureDeviceCore() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| DCHECK_NE(state_, kCapturing);
|
| - // If capture_machine is not NULL, then we need to return to the UI thread to
|
| - // safely stop the capture machine.
|
| + // If capture_machine is not NULL, then we need to safely
|
| + // stop the capture machine.
|
| if (capture_machine_) {
|
| - VideoCaptureMachine* capture_machine_ptr = capture_machine_.get();
|
| - BrowserThread::PostTask(
|
| - BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&VideoCaptureMachine::Stop,
|
| - base::Unretained(capture_machine_ptr),
|
| - base::Bind(&DeleteCaptureMachineOnUIThread,
|
| - base::Passed(&capture_machine_))));
|
| + capture_machine_->Stop(base::Bind(&DeleteCaptureMachine,
|
| + base::Passed(&capture_machine_)));
|
| }
|
| DVLOG(1) << "ContentVideoCaptureDeviceCore@" << this << " destroying.";
|
| }
|
|
|