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

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: . 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 194
195 cb.Run(media::PIPELINE_OK); 195 cb.Run(media::PIPELINE_OK);
196 state_ = kNormal; 196 state_ = kNormal;
197 } 197 }
198 198
199 void CaptureVideoDecoder::OnStoppedOnDecoderThread( 199 void CaptureVideoDecoder::OnStoppedOnDecoderThread(
200 media::VideoCapture* capture) { 200 media::VideoCapture* capture) {
201 DVLOG(1) << "OnStoppedOnDecoderThread"; 201 DVLOG(1) << "OnStoppedOnDecoderThread";
202 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 202 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
203 if (!pending_stop_cb_.is_null()) 203 if (!pending_stop_cb_.is_null())
204 media::ResetAndRunCB(&pending_stop_cb_); 204 pending_stop_cb_.ResetAndRun();
205 vc_manager_->RemoveDevice(video_stream_id_, this); 205 vc_manager_->RemoveDevice(video_stream_id_, this);
206 } 206 }
207 207
208 void CaptureVideoDecoder::OnDeviceInfoReceivedOnDecoderThread( 208 void CaptureVideoDecoder::OnDeviceInfoReceivedOnDecoderThread(
209 media::VideoCapture* capture, 209 media::VideoCapture* capture,
210 const media::VideoCaptureParams& device_info) { 210 const media::VideoCaptureParams& device_info) {
211 DCHECK(message_loop_proxy_->BelongsToCurrentThread()); 211 DCHECK(message_loop_proxy_->BelongsToCurrentThread());
212 if (device_info.width != natural_size_.width() || 212 if (device_info.width != natural_size_.width() ||
213 device_info.height != natural_size_.height()) { 213 device_info.height != natural_size_.height()) {
214 natural_size_.SetSize(device_info.width, device_info.height); 214 natural_size_.SetSize(device_info.width, device_info.height);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 capture->FeedBuffer(buf); 276 capture->FeedBuffer(buf);
277 } 277 }
278 278
279 void CaptureVideoDecoder::DeliverFrame( 279 void CaptureVideoDecoder::DeliverFrame(
280 const scoped_refptr<media::VideoFrame>& video_frame) { 280 const scoped_refptr<media::VideoFrame>& video_frame) {
281 // Reset the callback before running to protect against reentrancy. 281 // Reset the callback before running to protect against reentrancy.
282 ReadCB read_cb = read_cb_; 282 ReadCB read_cb = read_cb_;
283 read_cb_.Reset(); 283 read_cb_.Reset();
284 read_cb.Run(video_frame); 284 read_cb.Run(video_frame);
285 } 285 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698