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

Side by Side Diff: media/base/composite_filter.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 "media/base/composite_filter.h" 5 #include "media/base/composite_filter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 default: 283 default:
284 ChangeState(kError); 284 ChangeState(kError);
285 DispatchPendingCallback(PIPELINE_ERROR_INVALID_STATE); 285 DispatchPendingCallback(PIPELINE_ERROR_INVALID_STATE);
286 } 286 }
287 } 287 }
288 288
289 void CompositeFilter::DispatchPendingCallback(PipelineStatus status) { 289 void CompositeFilter::DispatchPendingCallback(PipelineStatus status) {
290 DCHECK(status_cb_.is_null() ^ callback_.is_null()); 290 DCHECK(status_cb_.is_null() ^ callback_.is_null());
291 291
292 if (!status_cb_.is_null()) { 292 if (!status_cb_.is_null()) {
293 ResetAndRunCB(&status_cb_, status); 293 status_cb_.ResetAndRun(status);
294 return; 294 return;
295 } 295 }
296 296
297 if (!callback_.is_null()) { 297 if (!callback_.is_null()) {
298 if (status != PIPELINE_OK) 298 if (status != PIPELINE_OK)
299 SendErrorToHost(status); 299 SendErrorToHost(status);
300 ResetAndRunCB(&callback_); 300 callback_.ResetAndRun();
301 } 301 }
302 } 302 }
303 303
304 CompositeFilter::State CompositeFilter::GetNextState(State state) const { 304 CompositeFilter::State CompositeFilter::GetNextState(State state) const {
305 State ret = kInvalid; 305 State ret = kInvalid;
306 switch (state) { 306 switch (state) {
307 case kPlayPending: 307 case kPlayPending:
308 ret = kPlaying; 308 ret = kPlaying;
309 break; 309 break;
310 case kPausePending: 310 case kPausePending:
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 492
493 void CompositeFilter::FilterHostImpl::NotifyEnded() { 493 void CompositeFilter::FilterHostImpl::NotifyEnded() {
494 host_->NotifyEnded(); 494 host_->NotifyEnded();
495 } 495 }
496 496
497 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() { 497 void CompositeFilter::FilterHostImpl::DisableAudioRenderer() {
498 host_->DisableAudioRenderer(); 498 host_->DisableAudioRenderer();
499 } 499 }
500 500
501 } // namespace media 501 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698