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

Side by Side Diff: remoting/host/video_scheduler.cc

Issue 14305004: Simplify ScreenCapturer interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | « remoting/host/ipc_video_frame_capturer.cc ('k') | remoting/host/video_scheduler_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "remoting/host/video_scheduler.h" 5 #include "remoting/host/video_scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 capture_timer_.reset(new base::OneShotTimer<VideoScheduler>()); 171 capture_timer_.reset(new base::OneShotTimer<VideoScheduler>());
172 172
173 // Capture first frame immedately. 173 // Capture first frame immedately.
174 CaptureNextFrame(); 174 CaptureNextFrame();
175 } 175 }
176 176
177 void VideoScheduler::StopOnCaptureThread() { 177 void VideoScheduler::StopOnCaptureThread() {
178 DCHECK(capture_task_runner_->BelongsToCurrentThread()); 178 DCHECK(capture_task_runner_->BelongsToCurrentThread());
179 179
180 // Stop |capturer_| and clear it to prevent pending tasks from using it. 180 // Stop |capturer_| and clear it to prevent pending tasks from using it.
181 capturer_->Stop(); 181 capturer_.reset();
alexeypa (please no reviews) 2013/04/22 16:23:19 |capturer_| can only be deleted only after the enc
Sergey Ulanov 2013/04/22 18:18:56 Oh, right. Do we need to call Stop() here at all?
alexeypa (please no reviews) 2013/04/22 18:36:37 Yes. It clears |delegate_| preventing the capturer
182 182
183 // |capture_timer_| must be destroyed on the thread on which it is used. 183 // |capture_timer_| must be destroyed on the thread on which it is used.
184 capture_timer_.reset(); 184 capture_timer_.reset();
185 185
186 // Schedule deletion of |capturer_| once the encode thread is no longer 186 // Schedule deletion of |capturer_| once the encode thread is no longer
187 // processing capture data. See http://crbug.com/163641. This also clears 187 // processing capture data. See http://crbug.com/163641. This also clears
188 // |capturer_| pointer to prevent pending tasks from using it. 188 // |capturer_| pointer to prevent pending tasks from using it.
189 // TODO(wez): Make it safe to tear down capturer while buffers remain, and 189 // TODO(wez): Make it safe to tear down capturer while buffers remain, and
190 // remove this work-around. 190 // remove this work-around.
191 encode_task_runner_->PostTask( 191 encode_task_runner_->PostTask(
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 328
329 // This is posted by StopOnCaptureThread, so we know that by the time we 329 // This is posted by StopOnCaptureThread, so we know that by the time we
330 // process it there are no more encode tasks queued. Pass |capturer_| for 330 // process it there are no more encode tasks queued. Pass |capturer_| for
331 // deletion on the thread that created it. 331 // deletion on the thread that created it.
332 network_task_runner_->PostTask( 332 network_task_runner_->PostTask(
333 FROM_HERE, base::Bind(&VideoScheduler::StopOnNetworkThread, this, 333 FROM_HERE, base::Bind(&VideoScheduler::StopOnNetworkThread, this,
334 base::Passed(&capturer))); 334 base::Passed(&capturer)));
335 } 335 }
336 336
337 } // namespace remoting 337 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/ipc_video_frame_capturer.cc ('k') | remoting/host/video_scheduler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698