| Index: ui/compositor/layer.cc
|
| diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
|
| index 9497b0eae45c183b109d64dc5a726d35f3124a44..2858ee6006e1b23d17dfe3e22de9085f0c2dedf0 100644
|
| --- a/ui/compositor/layer.cc
|
| +++ b/ui/compositor/layer.cc
|
| @@ -13,6 +13,7 @@
|
| #include "base/logging.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/trace_event/trace_event.h"
|
| +#include "cc/animation/animation_host.h"
|
| #include "cc/animation/animation_id_provider.h"
|
| #include "cc/animation/animation_player.h"
|
| #include "cc/animation/animation_timeline.h"
|
| @@ -997,8 +998,7 @@ void Layer::AddThreadedAnimation(scoped_ptr<cc::Animation> animation) {
|
| // Until this layer has a compositor (and hence cc_layer_ has a
|
| // LayerTreeHost), addAnimation will fail.
|
| if (GetCompositor()) {
|
| - animation_player_ ? animation_player_->AddAnimation(animation.Pass())
|
| - : (void)cc_layer_->AddAnimation(animation.Pass());
|
| + animation_player_->AddAnimation(animation.Pass());
|
| } else {
|
| pending_threaded_animations_.push_back(animation.Pass());
|
| }
|
| @@ -1023,8 +1023,7 @@ struct HasAnimationId {
|
| void Layer::RemoveThreadedAnimation(int animation_id) {
|
| DCHECK(cc_layer_);
|
| if (pending_threaded_animations_.size() == 0) {
|
| - animation_player_ ? animation_player_->RemoveAnimation(animation_id)
|
| - : cc_layer_->RemoveAnimation(animation_id);
|
| + animation_player_->RemoveAnimation(animation_id);
|
| return;
|
| }
|
|
|
| @@ -1045,9 +1044,7 @@ void Layer::SendPendingThreadedAnimations() {
|
| for (cc::ScopedPtrVector<cc::Animation>::iterator it =
|
| pending_threaded_animations_.begin();
|
| it != pending_threaded_animations_.end(); ++it) {
|
| - animation_player_
|
| - ? animation_player_->AddAnimation(pending_threaded_animations_.take(it))
|
| - : (void)cc_layer_->AddAnimation(pending_threaded_animations_.take(it));
|
| + animation_player_->AddAnimation(pending_threaded_animations_.take(it));
|
| }
|
|
|
| pending_threaded_animations_.clear();
|
| @@ -1080,28 +1077,18 @@ void Layer::CreateCcLayer() {
|
| void Layer::AttachAnimationObserversAndLayer() {
|
| DCHECK(cc_layer_);
|
|
|
| - if (animation_player_) {
|
| - animation_player_->AttachLayer(cc_layer_->id());
|
| - DCHECK(animation_player_->layer_animation_controller());
|
| - animation_player_->layer_animation_controller()->AddEventObserver(this);
|
| - } else {
|
| - if (cc_layer_->layer_animation_controller())
|
| - cc_layer_->AddLayerAnimationEventObserver(this);
|
| - }
|
| + animation_player_->AttachLayer(cc_layer_->id());
|
| + DCHECK(animation_player_->layer_animation_controller());
|
| + animation_player_->layer_animation_controller()->AddEventObserver(this);
|
|
|
| for (size_t i = 0; i < children_.size(); ++i)
|
| children_[i]->AttachAnimationObserversAndLayer();
|
| }
|
|
|
| void Layer::DetachAnimationObserversAndLayer() {
|
| - if (animation_player_) {
|
| - if (animation_player_->layer_animation_controller()) {
|
| - animation_player_->layer_animation_controller()->RemoveEventObserver(this);
|
| - animation_player_->DetachLayer();
|
| - }
|
| - } else {
|
| - if (cc_layer_->layer_animation_controller())
|
| - cc_layer_->RemoveLayerAnimationEventObserver(this);
|
| + if (animation_player_->layer_animation_controller()) {
|
| + animation_player_->layer_animation_controller()->RemoveEventObserver(this);
|
| + animation_player_->DetachLayer();
|
| }
|
|
|
| for (size_t i = 0; i < children_.size(); ++i)
|
| @@ -1110,15 +1097,9 @@ void Layer::DetachAnimationObserversAndLayer() {
|
|
|
| void Layer::CreateAnimationPlayers(Compositor* compositor) {
|
| DCHECK(compositor);
|
| - const cc::LayerTreeHost& host = compositor->GetLayerTreeHost();
|
| - cc_layer_->RegisterForAnimations(host.animation_registrar(), host.settings());
|
| -
|
| - if (host.settings().use_compositor_animation_timelines) {
|
| - if (!animation_player_) {
|
| - animation_player_ =
|
| - cc::AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId());
|
| - }
|
| - }
|
| +
|
| + animation_player_ =
|
| + cc::AnimationPlayer::Create(cc::AnimationIdProvider::NextPlayerId());
|
|
|
| for (size_t i = 0; i < children_.size(); ++i)
|
| children_[i]->CreateAnimationPlayers(compositor);
|
| @@ -1127,8 +1108,7 @@ void Layer::CreateAnimationPlayers(Compositor* compositor) {
|
| void Layer::AttachAnimationPlayer(Compositor* compositor) {
|
| DCHECK(compositor);
|
|
|
| - if (animation_player_)
|
| - compositor->GetAnimationTimeline()->AttachPlayer(animation_player_.get());
|
| + compositor->GetAnimationTimeline()->AttachPlayer(animation_player_.get());
|
|
|
| for (size_t i = 0; i < children_.size(); ++i)
|
| children_[i]->AttachAnimationPlayer(compositor);
|
| @@ -1138,8 +1118,7 @@ void Layer::DetachAnimationPlayer() {
|
| Compositor* compositor = GetCompositor();
|
| DCHECK(compositor);
|
|
|
| - if (animation_player_)
|
| - compositor->GetAnimationTimeline()->DetachPlayer(animation_player_.get());
|
| + compositor->GetAnimationTimeline()->DetachPlayer(animation_player_.get());
|
|
|
| for (size_t i = 0; i < children_.size(); ++i)
|
| children_[i]->DetachAnimationPlayer();
|
|
|