diff options
author | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 18:47:38 +0000 |
---|---|---|
committer | ajuma@chromium.org <ajuma@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 18:47:38 +0000 |
commit | 3d75fedec4f4d01c0fb52c61a7fb0adb2b64c377 (patch) | |
tree | c0dd20b995735c4227b8c24519347e27c0f31941 /ui/compositor/layer_animation_element.cc | |
parent | 8da1670a91dab1c2d7ad5a83c3e66da94503bb15 (diff) | |
download | chromium_src-3d75fedec4f4d01c0fb52c61a7fb0adb2b64c377.zip chromium_src-3d75fedec4f4d01c0fb52c61a7fb0adb2b64c377.tar.gz chromium_src-3d75fedec4f4d01c0fb52c61a7fb0adb2b64c377.tar.bz2 |
Make ui::LayerAnimationSequence and ui::LayerAnimationElement use absolute times
Currently, LayerAnimationSequences and LayerAnimationElements only know
about the relative offset from the start of the animation. However, for threaded
UI animations, a LayerAnimationElement will need to know its absolute start
time: in order to compute the delay incurred by dispatching the animation to the
compositor thread, it will need to compare its own start time with that of the
dispatched animation.
BUG=164206
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/11465026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173301 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor/layer_animation_element.cc')
-rw-r--r-- | ui/compositor/layer_animation_element.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc index ef18104..6c9aa39 100644 --- a/ui/compositor/layer_animation_element.cc +++ b/ui/compositor/layer_animation_element.cc @@ -405,8 +405,10 @@ LayerAnimationElement::LayerAnimationElement( LayerAnimationElement::~LayerAnimationElement() { } -bool LayerAnimationElement::Progress(base::TimeDelta elapsed, +bool LayerAnimationElement::Progress(base::TimeTicks now, LayerAnimationDelegate* delegate) { + DCHECK(start_time_ != base::TimeTicks()); + base::TimeDelta elapsed = now - start_time_; if (first_frame_) OnStart(delegate); double t = 1.0; @@ -417,8 +419,9 @@ bool LayerAnimationElement::Progress(base::TimeDelta elapsed, return need_draw; } -bool LayerAnimationElement::IsFinished(base::TimeDelta elapsed, +bool LayerAnimationElement::IsFinished(base::TimeTicks time, base::TimeDelta* total_duration) { + base::TimeDelta elapsed = time - start_time_; if (elapsed >= duration_) { *total_duration = duration_; return true; @@ -427,7 +430,11 @@ bool LayerAnimationElement::IsFinished(base::TimeDelta elapsed, } bool LayerAnimationElement::ProgressToEnd(LayerAnimationDelegate* delegate) { - return Progress(duration_, delegate); + if (first_frame_) + OnStart(delegate); + bool need_draw = OnProgress(1.0, delegate); + first_frame_ = true; + return need_draw; } void LayerAnimationElement::GetTargetValue(TargetValue* target) const { |