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

Side by Side Diff: content/renderer/media/capture_video_decoder.cc

Issue 9717021: Make Callback::Reset() return a copy to support use-cases where Run() ends up modifying |*this|. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 9 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
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 "content/renderer/media/capture_video_decoder.h" 5 #include "content/renderer/media/capture_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/renderer/media/video_capture_impl_manager.h" 8 #include "content/renderer/media/video_capture_impl_manager.h"
9 #include "media/base/filter_host.h" 9 #include "media/base/filter_host.h"
10 #include "media/base/limits.h" 10 #include "media/base/limits.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 195
196 cb.Run(media::PIPELINE_OK); 196 cb.Run(media::PIPELINE_OK);
197 state_ = kNormal; 197 state_ = kNormal;
198 } 198 }
199 199
200 void CaptureVideoDecoder::OnStoppedOnDecoderThread( 200 void CaptureVideoDecoder::OnStoppedOnDecoderThread(
201 media::VideoCapture* capture) { 201 media::VideoCapture* capture) {
202 DVLOG(1) << "OnStoppedOnDecoderThread"; 202 DVLOG(1) << "OnStoppedOnDecoderThread";
203 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 203 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
204 if (!pending_stop_cb_.is_null()) 204 if (!pending_stop_cb_.is_null())
205 media::ResetAndRunCB(&pending_stop_cb_); 205 pending_stop_cb_.ResetAndRun();
206 vc_manager_->RemoveDevice(video_stream_id_, this); 206 vc_manager_->RemoveDevice(video_stream_id_, this);
207 } 207 }
208 208
209 void CaptureVideoDecoder::OnDeviceInfoReceivedOnDecoderThread( 209 void CaptureVideoDecoder::OnDeviceInfoReceivedOnDecoderThread(
210 media::VideoCapture* capture, 210 media::VideoCapture* capture,
211 const media::VideoCaptureParams& device_info) { 211 const media::VideoCaptureParams& device_info) {
212 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 212 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
213 if (device_info.width != natural_size_.width() || 213 if (device_info.width != natural_size_.width() ||
214 device_info.height != natural_size_.height()) { 214 device_info.height != natural_size_.height()) {
215 natural_size_.SetSize(device_info.width, device_info.height); 215 natural_size_.SetSize(device_info.width, device_info.height);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 capture->FeedBuffer(buf); 277 capture->FeedBuffer(buf);
278 } 278 }
279 279
280 void CaptureVideoDecoder::DeliverFrame( 280 void CaptureVideoDecoder::DeliverFrame(
281 const scoped_refptr<media::VideoFrame>& video_frame) { 281 const scoped_refptr<media::VideoFrame>& video_frame) {
282 // Reset the callback before running to protect against reentrancy. 282 // Reset the callback before running to protect against reentrancy.
283 ReadCB read_cb = read_cb_; 283 ReadCB read_cb = read_cb_;
284 read_cb_.Reset(); 284 read_cb_.Reset();
285 read_cb.Run(video_frame); 285 read_cb.Run(video_frame);
286 } 286 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698