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

Side by Side Diff: ui/compositor/layer_animator.cc

Issue 795113002: compositor/layer_animator: handle delegate removal in LayerAnimation::StopAnimating (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixups for test Created 5 years, 11 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
« no previous file with comments | « no previous file | ui/compositor/layer_animator_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 "ui/compositor/layer_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "cc/animation/animation_id_provider.h" 10 #include "cc/animation/animation_id_provider.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 if (running_animations_copy[i].sequence()->IsFinished(now)) { 402 if (running_animations_copy[i].sequence()->IsFinished(now)) {
403 SAFE_INVOKE_VOID(FinishAnimation, running_animations_copy[i], false); 403 SAFE_INVOKE_VOID(FinishAnimation, running_animations_copy[i], false);
404 } else { 404 } else {
405 SAFE_INVOKE_VOID(ProgressAnimation, running_animations_copy[i], now); 405 SAFE_INVOKE_VOID(ProgressAnimation, running_animations_copy[i], now);
406 } 406 }
407 } 407 }
408 } 408 }
409 409
410 void LayerAnimator::StopAnimatingInternal(bool abort) { 410 void LayerAnimator::StopAnimatingInternal(bool abort) {
411 scoped_refptr<LayerAnimator> retain(this); 411 scoped_refptr<LayerAnimator> retain(this);
412 while (is_animating()) { 412 while (is_animating() && delegate()) {
413 // We're going to attempt to finish the first running animation. Let's 413 // We're going to attempt to finish the first running animation. Let's
414 // ensure that it's valid. 414 // ensure that it's valid.
415 PurgeDeletedAnimations(); 415 PurgeDeletedAnimations();
416 416
417 // If we've purged all running animations, attempt to start one up. 417 // If we've purged all running animations, attempt to start one up.
418 if (running_animations_.empty()) 418 if (running_animations_.empty())
419 ProcessQueue(); 419 ProcessQueue();
420 420
421 DCHECK(!running_animations_.empty()); 421 DCHECK(!running_animations_.empty());
422 422
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 } 510 }
511 511
512 void LayerAnimator::FinishAnimation( 512 void LayerAnimator::FinishAnimation(
513 LayerAnimationSequence* sequence, bool abort) { 513 LayerAnimationSequence* sequence, bool abort) {
514 scoped_refptr<LayerAnimator> retain(this); 514 scoped_refptr<LayerAnimator> retain(this);
515 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence)); 515 scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence));
516 if (abort) 516 if (abort)
517 sequence->Abort(delegate()); 517 sequence->Abort(delegate());
518 else 518 else
519 ProgressAnimationToEnd(sequence); 519 ProgressAnimationToEnd(sequence);
520 if (!delegate())
521 return;
520 ProcessQueue(); 522 ProcessQueue();
521 UpdateAnimationState(); 523 UpdateAnimationState();
522 } 524 }
523 525
524 void LayerAnimator::FinishAnyAnimationWithZeroDuration() { 526 void LayerAnimator::FinishAnyAnimationWithZeroDuration() {
525 scoped_refptr<LayerAnimator> retain(this); 527 scoped_refptr<LayerAnimator> retain(this);
526 // Special case: if we've started a 0 duration animation, just finish it now 528 // Special case: if we've started a 0 duration animation, just finish it now
527 // and get rid of it. We need to make a copy because Progress may indirectly 529 // and get rid of it. We need to make a copy because Progress may indirectly
528 // cause new animations to start running. 530 // cause new animations to start running.
529 RunningAnimations running_animations_copy = running_animations_; 531 RunningAnimations running_animations_copy = running_animations_;
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 } 855 }
854 856
855 LayerAnimator::RunningAnimation::RunningAnimation( 857 LayerAnimator::RunningAnimation::RunningAnimation(
856 const base::WeakPtr<LayerAnimationSequence>& sequence) 858 const base::WeakPtr<LayerAnimationSequence>& sequence)
857 : sequence_(sequence) { 859 : sequence_(sequence) {
858 } 860 }
859 861
860 LayerAnimator::RunningAnimation::~RunningAnimation() { } 862 LayerAnimator::RunningAnimation::~RunningAnimation() { }
861 863
862 } // namespace ui 864 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/compositor/layer_animator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698