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

Unified Diff: ui/compositor/layer_animation_sequence.cc

Issue 10919195: LayerAnimator must be prepared for its owning layer's deletion whenever it notifies observers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing the unit tests. Created 8 years, 3 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_animation_sequence.h ('k') | ui/compositor/layer_animator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animation_sequence.cc
diff --git a/ui/compositor/layer_animation_sequence.cc b/ui/compositor/layer_animation_sequence.cc
index 646c5f1fd828bcea8b55ebb42ee6e8cc8e166e85..2a58e1fdf5be9db1edd8aca80ce248a04b0051a0 100644
--- a/ui/compositor/layer_animation_sequence.cc
+++ b/ui/compositor/layer_animation_sequence.cc
@@ -31,12 +31,12 @@ LayerAnimationSequence::~LayerAnimationSequence() {
DetachedFromSequence(this, true));
}
-bool LayerAnimationSequence::Progress(base::TimeDelta elapsed,
+void LayerAnimationSequence::Progress(base::TimeDelta elapsed,
LayerAnimationDelegate* delegate) {
bool redraw_required = false;
if (elements_.empty())
- return redraw_required;
+ return;
if (is_cyclic_ && duration_ > base::TimeDelta()) {
// If delta = elapsed - last_start_ is huge, we can skip ahead by complete
@@ -69,13 +69,16 @@ bool LayerAnimationSequence::Progress(base::TimeDelta elapsed,
redraw_required = true;
}
+ // Since the delegate may be deleted due to the notifications below, it is
+ // important that we schedule a draw before sending them.
+ if (redraw_required)
+ delegate->ScheduleDrawForAnimation();
+
if (!is_cyclic_ && elapsed == duration_) {
last_element_ = 0;
last_start_ = base::TimeDelta::FromMilliseconds(0);
NotifyEnded();
}
-
- return redraw_required;
}
void LayerAnimationSequence::GetTargetValue(
« no previous file with comments | « ui/compositor/layer_animation_sequence.h ('k') | ui/compositor/layer_animator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698