Remove ui::LayerAnimationSequence::duration and ui::LayerAnimationElement::duration.
This change is in preparation for threading certain ui animations. When we do
this, the actual duration of an element will not be known ahead of time, since
dispatching the element to the compositor thread will involve a small delay.
BUG=164206
Review URL: https://chromiumcodereview.appspot.com/11316315
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171112 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
index a6fcd7d..98261fe 100644
--- a/ui/compositor/layer_animator.cc
+++ b/ui/compositor/layer_animator.cc
@@ -333,7 +333,10 @@
}
void LayerAnimator::ProgressAnimationToEnd(LayerAnimationSequence* sequence) {
- ProgressAnimation(sequence, sequence->duration());
+ if (!delegate())
+ return;
+
+ sequence->ProgressToEnd(delegate());
}
@@ -365,8 +368,7 @@
continue;
base::TimeDelta delta = now - running_animations_copy[i].start_time();
- if (delta >= running_animations_copy[i].sequence()->duration() &&
- !running_animations_copy[i].sequence()->is_cyclic()) {
+ if (running_animations_copy[i].sequence()->IsFinished(delta)) {
SAFE_INVOKE_VOID(FinishAnimation, running_animations_copy[i]);
} else
SAFE_INVOKE_VOID(ProgressAnimation, running_animations_copy[i], delta);
@@ -423,8 +425,7 @@
void LayerAnimator::FinishAnimation(LayerAnimationSequence* sequence) {
scoped_refptr<LayerAnimator> retain(this);
scoped_ptr<LayerAnimationSequence> removed(RemoveAnimation(sequence));
- if (delegate())
- sequence->Progress(sequence->duration(), delegate());
+ ProgressAnimationToEnd(sequence);
ProcessQueue();
UpdateAnimationState();
}
@@ -439,8 +440,7 @@
if (!SAFE_INVOKE_BOOL(HasAnimation, running_animations_copy[i]))
continue;
- if (running_animations_copy[i].sequence()->duration() ==
- base::TimeDelta()) {
+ if (running_animations_copy[i].sequence()->IsFinished(base::TimeDelta())) {
SAFE_INVOKE_VOID(ProgressAnimationToEnd, running_animations_copy[i]);
scoped_ptr<LayerAnimationSequence> removed(
SAFE_INVOKE_PTR(RemoveAnimation, running_animations_copy[i]));
@@ -540,7 +540,7 @@
if (!weak_sequence_ptr)
return;
- ProgressAnimation(sequence, sequence->duration());
+ ProgressAnimationToEnd(sequence);
if (!weak_sequence_ptr)
return;