| Index: ui/compositor/layer_animator_collection.cc
|
| diff --git a/ui/compositor/layer_animator_collection.cc b/ui/compositor/layer_animator_collection.cc
|
| index 12142d88827175352af7545b0924940c5ff6eaa4..0e0fc05b43fb38b8204dc09a4416664ef7233490 100644
|
| --- a/ui/compositor/layer_animator_collection.cc
|
| +++ b/ui/compositor/layer_animator_collection.cc
|
| @@ -13,9 +13,8 @@
|
| namespace ui {
|
|
|
| LayerAnimatorCollection::LayerAnimatorCollection(
|
| - LayerAnimatorCollectionDelegate* delegate)
|
| - : delegate_(delegate),
|
| - last_tick_time_(gfx::FrameTime::Now()) {
|
| + AnimationFrameTaskProvider* provider)
|
| + : provider_(provider), last_tick_time_(gfx::FrameTime::Now()) {
|
| }
|
|
|
| LayerAnimatorCollection::~LayerAnimatorCollection() {
|
| @@ -27,21 +26,24 @@ void LayerAnimatorCollection::StartAnimator(
|
| if (!animators_.size())
|
| last_tick_time_ = gfx::FrameTime::Now();
|
| animators_.insert(animator);
|
| - if (delegate_)
|
| - delegate_->ScheduleAnimationForLayerCollection();
|
| + if (!raf_callback_ && provider_)
|
| + raf_callback_ = provider_->RequestAnimationFrameTask(this);
|
| }
|
|
|
| void LayerAnimatorCollection::StopAnimator(
|
| scoped_refptr<LayerAnimator> animator) {
|
| DCHECK_GT(animators_.count(animator), 0U);
|
| animators_.erase(animator);
|
| + if (animators_.empty() && raf_callback_)
|
| + raf_callback_.reset();
|
| }
|
|
|
| bool LayerAnimatorCollection::HasActiveAnimators() const {
|
| return !animators_.empty();
|
| }
|
|
|
| -void LayerAnimatorCollection::Progress(base::TimeTicks now) {
|
| +AnimationFrameTaskStatus LayerAnimatorCollection::Progress(
|
| + base::TimeTicks now) {
|
| last_tick_time_ = now;
|
| std::set<scoped_refptr<LayerAnimator> > list = animators_;
|
| for (std::set<scoped_refptr<LayerAnimator> >::iterator iter = list.begin();
|
| @@ -51,6 +53,8 @@ void LayerAnimatorCollection::Progress(base::TimeTicks now) {
|
| if (animators_.count(*iter) > 0)
|
| (*iter)->Step(now);
|
| }
|
| + return HasActiveAnimators() ? ANIMATION_FRAME_TASK_CONTINUE
|
| + : ANIMATION_FRAME_TASK_END;
|
| }
|
|
|
| } // namespace ui
|
|
|