Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(789)

Side by Side Diff: media/filters/video_frame_scheduler_proxy.cc

Issue 251833004: Make VideoFrameSchedulerProxy own the scheduler it is proxying. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/filters/video_frame_scheduler_proxy.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/video_frame_scheduler_proxy.h" 5 #include "media/filters/video_frame_scheduler_proxy.h"
6 6
7 #include "base/single_thread_task_runner.h" 7 #include "base/single_thread_task_runner.h"
8 #include "media/base/bind_to_current_loop.h" 8 #include "media/base/bind_to_current_loop.h"
9 #include "media/base/video_frame.h" 9 #include "media/base/video_frame.h"
10 10
11 namespace media { 11 namespace media {
12 12
13 VideoFrameSchedulerProxy::VideoFrameSchedulerProxy( 13 VideoFrameSchedulerProxy::VideoFrameSchedulerProxy(
14 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 14 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
15 const scoped_refptr<base::SingleThreadTaskRunner>& scheduler_runner, 15 const scoped_refptr<base::SingleThreadTaskRunner>& scheduler_runner,
16 VideoFrameScheduler* scheduler) 16 scoped_ptr<VideoFrameScheduler> scheduler)
17 : task_runner_(task_runner), 17 : task_runner_(task_runner),
18 scheduler_runner_(scheduler_runner), 18 scheduler_runner_(scheduler_runner),
19 scheduler_(scheduler), 19 scheduler_(scheduler.Pass()),
20 weak_factory_(this) { 20 weak_factory_(this) {
21 } 21 }
22 22
23 VideoFrameSchedulerProxy::~VideoFrameSchedulerProxy() { 23 VideoFrameSchedulerProxy::~VideoFrameSchedulerProxy() {
24 scheduler_runner_->DeleteSoon(FROM_HERE, scheduler_.release());
24 } 25 }
25 26
26 void VideoFrameSchedulerProxy::ScheduleVideoFrame( 27 void VideoFrameSchedulerProxy::ScheduleVideoFrame(
27 const scoped_refptr<VideoFrame>& frame, 28 const scoped_refptr<VideoFrame>& frame,
28 base::TimeTicks wall_ticks, 29 base::TimeTicks wall_ticks,
29 const DoneCB& done_cb) { 30 const DoneCB& done_cb) {
30 DCHECK(task_runner_->BelongsToCurrentThread()); 31 DCHECK(task_runner_->BelongsToCurrentThread());
31 scheduler_runner_->PostTask( 32 scheduler_runner_->PostTask(
32 FROM_HERE, 33 FROM_HERE,
33 base::Bind(&VideoFrameScheduler::ScheduleVideoFrame, 34 base::Bind(&VideoFrameScheduler::ScheduleVideoFrame,
34 base::Unretained(scheduler_), 35 base::Unretained(scheduler_.get()),
35 frame, 36 frame,
36 wall_ticks, 37 wall_ticks,
37 BindToCurrentLoop(done_cb))); 38 BindToCurrentLoop(done_cb)));
38 } 39 }
39 40
40 void VideoFrameSchedulerProxy::Reset() { 41 void VideoFrameSchedulerProxy::Reset() {
41 DCHECK(task_runner_->BelongsToCurrentThread()); 42 DCHECK(task_runner_->BelongsToCurrentThread());
42 scheduler_runner_->PostTask( 43 scheduler_runner_->PostTask(FROM_HERE,
43 FROM_HERE, 44 base::Bind(&VideoFrameScheduler::Reset,
44 base::Bind(&VideoFrameScheduler::Reset, base::Unretained(scheduler_))); 45 base::Unretained(scheduler_.get())));
45 } 46 }
46 47
47 } // namespace media 48 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/video_frame_scheduler_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698