| Index: ui/compositor/layer_animator.cc
|
| diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc
|
| index edd47487a9b4bf7218f005bfeed390391a3af7ae..5af6fb6ae5c04a825d96fe7044288a0458cfaec7 100644
|
| --- a/ui/compositor/layer_animator.cc
|
| +++ b/ui/compositor/layer_animator.cc
|
| @@ -135,59 +135,30 @@ void LayerAnimator::SetDelegate(LayerAnimationDelegate* delegate) {
|
| }
|
|
|
| void LayerAnimator::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) {
|
| - // Release ElementAnimations state for old layer.
|
| - element_animations_state_ = nullptr;
|
| -
|
| if (delegate_)
|
| DetachLayerFromAnimationPlayer();
|
| if (new_layer)
|
| AttachLayerToAnimationPlayer(new_layer->id());
|
| }
|
|
|
| -void LayerAnimator::SetCompositor(Compositor* compositor) {
|
| +void LayerAnimator::AttachLayerAndTimeline(Compositor* compositor) {
|
| DCHECK(compositor);
|
|
|
| cc::AnimationTimeline* timeline = compositor->GetAnimationTimeline();
|
| DCHECK(timeline);
|
| -
|
| - DCHECK(delegate_->GetCcLayer());
|
| -
|
| - // Register ElementAnimations so it will be picked up by
|
| - // AnimationHost::RegisterPlayerForLayer via
|
| - // AnimationHost::GetElementAnimationsForLayerId.
|
| - if (element_animations_state_) {
|
| - DCHECK_EQ(element_animations_state_->element_id().primaryId,
|
| - delegate_->GetCcLayer()->id());
|
| - timeline->animation_host()->RegisterElementAnimations(
|
| - element_animations_state_.get());
|
| - }
|
| -
|
| timeline->AttachPlayer(animation_player_);
|
|
|
| + DCHECK(delegate_->GetCcLayer());
|
| AttachLayerToAnimationPlayer(delegate_->GetCcLayer()->id());
|
| -
|
| - // Release ElementAnimations state.
|
| - element_animations_state_ = nullptr;
|
| }
|
|
|
| -void LayerAnimator::ResetCompositor(Compositor* compositor) {
|
| +void LayerAnimator::DetachLayerAndTimeline(Compositor* compositor) {
|
| DCHECK(compositor);
|
|
|
| cc::AnimationTimeline* timeline = compositor->GetAnimationTimeline();
|
| DCHECK(timeline);
|
|
|
| - cc::ElementId element_id(animation_player_->element_id());
|
| -
|
| - // Store a reference to ElementAnimations (if any)
|
| - // so it may be picked up in LayerAnimator::SetCompositor.
|
| - if (element_id) {
|
| - element_animations_state_ =
|
| - timeline->animation_host()->GetElementAnimationsForElementId(
|
| - element_id);
|
| - }
|
| -
|
| DetachLayerFromAnimationPlayer();
|
| -
|
| timeline->DetachPlayer(animation_player_);
|
| }
|
|
|
|
|