Chromium Code Reviews| Index: content/renderer/media/video_capture_impl.cc |
| diff --git a/content/renderer/media/video_capture_impl.cc b/content/renderer/media/video_capture_impl.cc |
| index 7a269c6fe9271cca5eeaff60b7e0934ee8323e5c..def86de91ef78802aa7b7a1caa49c9e6c598d975 100644 |
| --- a/content/renderer/media/video_capture_impl.cc |
| +++ b/content/renderer/media/video_capture_impl.cc |
| @@ -105,33 +105,25 @@ VideoCaptureImpl::ClientInfo::ClientInfo(const ClientInfo& other) = default; |
| VideoCaptureImpl::ClientInfo::~ClientInfo() {} |
| VideoCaptureImpl::VideoCaptureImpl( |
| - const media::VideoCaptureSessionId session_id, |
| - VideoCaptureMessageFilter* filter) |
| + media::VideoCaptureSessionId session_id, |
| + VideoCaptureMessageFilter* filter, |
| + const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner) |
| : message_filter_(filter), |
| device_id_(0), |
| session_id_(session_id), |
| suspended_(false), |
| state_(VIDEO_CAPTURE_STATE_STOPPED), |
| + io_task_runner_(io_task_runner), |
| weak_factory_(this) { |
| DCHECK(filter); |
| + io_task_runner_->PostTask(FROM_HERE, |
| + base::Bind(&VideoCaptureMessageFilter::AddDelegate, |
| + message_filter_, this)); |
| + // message_filter_->AddDelegate(this); |
|
chfremer
2016/09/28 23:28:09
Can be removed?
mcasas
2016/09/28 23:49:52
oops, yeah, done.
|
| } |
| VideoCaptureImpl::~VideoCaptureImpl() { |
| DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| -} |
| - |
| -void VideoCaptureImpl::Init() { |
| - // For creating callbacks in unittest, this class may be constructed from a |
| - // different thread than the IO thread, e.g. wherever unittest runs on. |
| - // Therefore, this function should define the thread ownership. |
| -#if DCHECK_IS_ON() |
| - io_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
| -#endif |
| - message_filter_->AddDelegate(this); |
| -} |
| - |
| -void VideoCaptureImpl::DeInit() { |
| - DCHECK(io_task_runner_->BelongsToCurrentThread()); |
| if (state_ == VIDEO_CAPTURE_STATE_STARTED) |
| Send(new VideoCaptureHostMsg_Stop(device_id_)); |
| message_filter_->RemoveDelegate(this); |