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

Unified Diff: ui/compositor/layer_animator.cc

Issue 10874064: Fixes crash introduced @ 153047 (you can hit crash by maximizing a (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animator.cc
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index 5fc289b42c79868d2d8f2a161b1db0595eb381be..19214745f101a417ee0d97309c790befe44317fb 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -43,13 +43,16 @@ LayerAnimator::LayerAnimator(base::TimeDelta transition_duration)
transition_duration_(transition_duration),
tween_type_(Tween::LINEAR),
is_started_(false),
- disable_timer_for_test_(false) {
+ disable_timer_for_test_(false),
+ destroyed_(NULL) {
}
LayerAnimator::~LayerAnimator() {
for (size_t i = 0; i < running_animations_.size(); ++i)
running_animations_[i].sequence->OnAnimatorDestroyed();
ClearAnimations();
+ if (destroyed_)
+ *destroyed_ = true;
}
// static
@@ -280,6 +283,8 @@ bool LayerAnimator::HasAnimation(LayerAnimationSequence* sequence) const {
void LayerAnimator::Step(base::TimeTicks now) {
TRACE_EVENT0("ui", "LayerAnimator::Step");
+ bool destroyed = false;
+ destroyed_ = &destroyed;
last_step_time_ = now;
// We need to make a copy of the running animations because progressing them
// and finishing them may indirectly affect the collection of running
@@ -294,11 +299,15 @@ void LayerAnimator::Step(base::TimeTicks now) {
if (delta >= running_animations_copy[i].sequence->duration() &&
!running_animations_copy[i].sequence->is_cyclic()) {
FinishAnimation(running_animations_copy[i].sequence);
+ if (destroyed)
+ return;
needs_redraw = true;
- } else if (ProgressAnimation(running_animations_copy[i].sequence, delta))
+ } else if (ProgressAnimation(running_animations_copy[i].sequence, delta)) {
needs_redraw = true;
+ }
}
+ destroyed_ = NULL;
if (needs_redraw && delegate())
delegate()->ScheduleDrawForAnimation();
}
« no previous file with comments | « ui/compositor/layer_animator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698