Chromium Code Reviews| Index: ui/compositor/layer_animator.cc |
| diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc |
| index ce2b0ff364d9d7b5150ba90fa8879c5f8f46cc04..67c418aa082a0ca852cc2644a4d70269f145ee62 100644 |
| --- a/ui/compositor/layer_animator.cc |
| +++ b/ui/compositor/layer_animator.cc |
| @@ -14,7 +14,7 @@ |
| #include "ui/compositor/layer_animation_delegate.h" |
| #include "ui/compositor/layer_animation_observer.h" |
| #include "ui/compositor/layer_animation_sequence.h" |
| -#include "ui/gfx/animation/animation_container.h" |
| +#include "ui/compositor/layer_animator_collection.h" |
| #include "ui/gfx/frame_time.h" |
| #define SAFE_INVOKE_VOID(function, running_anim, ...) \ |
| @@ -31,22 +31,9 @@ |
| namespace ui { |
| -class LayerAnimator; |
| - |
| namespace { |
| const int kDefaultTransitionDurationMs = 120; |
| -const int kTimerIntervalMs = 10; |
| - |
| -// Returns the AnimationContainer we're added to. |
| -gfx::AnimationContainer* GetAnimationContainer() { |
| - static gfx::AnimationContainer* container = NULL; |
| - if (!container) { |
| - container = new gfx::AnimationContainer(); |
| - container->AddRef(); |
| - } |
| - return container; |
| -} |
| } // namespace |
| @@ -181,8 +168,10 @@ void LayerAnimator::StartTogether( |
| adding_animations_ = true; |
| if (!is_animating()) { |
| - if (GetAnimationContainer()->is_running()) |
| - last_step_time_ = GetAnimationContainer()->last_tick_time(); |
| + LayerAnimatorCollection* collection = |
| + LayerAnimatorCollection::GetInstance(); |
| + if (collection->HasActiveAnimators()) |
| + last_step_time_ = collection->last_tick_time(); |
| else |
| last_step_time_ = gfx::FrameTime::Now(); |
| } |
| @@ -395,14 +384,6 @@ void LayerAnimator::Step(base::TimeTicks now) { |
| } |
| } |
| -void LayerAnimator::SetStartTime(base::TimeTicks start_time) { |
| - // Do nothing. |
| -} |
| - |
| -base::TimeDelta LayerAnimator::GetTimerInterval() const { |
| - return base::TimeDelta::FromMilliseconds(kTimerIntervalMs); |
| -} |
| - |
| void LayerAnimator::StopAnimatingInternal(bool abort) { |
| scoped_refptr<LayerAnimator> retain(this); |
| while (is_animating()) { |
| @@ -432,9 +413,9 @@ void LayerAnimator::UpdateAnimationState() { |
| const bool should_start = is_animating(); |
| if (should_start && !is_started_) |
| - GetAnimationContainer()->Start(this); |
| + LayerAnimatorCollection::GetInstance()->StartAnimator(this); |
| else if (!should_start && is_started_) |
| - GetAnimationContainer()->Stop(this); |
| + LayerAnimatorCollection::GetInstance()->StopAnimator(this); |
| is_started_ = should_start; |
| } |
| @@ -753,14 +734,14 @@ bool LayerAnimator::StartSequenceImmediately(LayerAnimationSequence* sequence) { |
| // a resolution that can be as bad as 15ms. If this causes glitches in the |
| // animations, this can be switched to HighResNow() (animation uses Now() |
| // internally). |
| - // All LayerAnimators share the same AnimationContainer. Use the |
| + // All LayerAnimators share the same LayerAnimatorCollection. Use the |
| // last_tick_time() from there to ensure animations started during the same |
| // event complete at the same time. |
| base::TimeTicks start_time; |
| if (is_animating() || adding_animations_) |
| start_time = last_step_time_; |
| - else if (GetAnimationContainer()->is_running()) |
| - start_time = GetAnimationContainer()->last_tick_time(); |
| + else if (LayerAnimatorCollection::GetInstance()->HasActiveAnimators()) |
| + start_time = LayerAnimatorCollection::GetInstance()->last_tick_time(); |
|
ajuma
2014/05/23 17:10:00
It's possible for LayerAnimatorCollection to have
sadrul
2014/05/23 18:02:42
Done.
|
| else |
| start_time = gfx::FrameTime::Now(); |