Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: ui/compositor/layer_animator.cc

Issue 1887593003: CC Animation: Make layer_animation_controller a private member of ElementAnimations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_host_unittest_animation.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/compositor/layer_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 AttachLayerToAnimationPlayer(delegate_->GetCcLayer()->id()); 168 AttachLayerToAnimationPlayer(delegate_->GetCcLayer()->id());
169 169
170 // Release LAC (it is referenced in ElementAnimations). 170 // Release LAC (it is referenced in ElementAnimations).
171 animation_controller_state_ = nullptr; 171 animation_controller_state_ = nullptr;
172 } 172 }
173 173
174 void LayerAnimator::ResetCompositor(Compositor* compositor) { 174 void LayerAnimator::ResetCompositor(Compositor* compositor) {
175 DCHECK(compositor); 175 DCHECK(compositor);
176 176
177 cc::AnimationTimeline* timeline = compositor->GetAnimationTimeline();
178 DCHECK(timeline);
179
180 const int layer_id = animation_player_->layer_id();
181
177 // Store a reference to LAC if any so it may be picked up in SetCompositor. 182 // Store a reference to LAC if any so it may be picked up in SetCompositor.
178 if (animation_player_->element_animations()) { 183 if (layer_id) {
179 animation_controller_state_ = 184 animation_controller_state_ =
180 animation_player_->element_animations()->layer_animation_controller(); 185 timeline->animation_host()->GetControllerForLayerId(layer_id);
181 } 186 }
182 187
183 DetachLayerFromAnimationPlayer(); 188 DetachLayerFromAnimationPlayer();
184 189
185 cc::AnimationTimeline* timeline = compositor->GetAnimationTimeline();
186 DCHECK(timeline);
187 timeline->DetachPlayer(animation_player_); 190 timeline->DetachPlayer(animation_player_);
188 } 191 }
189 192
190 void LayerAnimator::AttachLayerToAnimationPlayer(int layer_id) { 193 void LayerAnimator::AttachLayerToAnimationPlayer(int layer_id) {
191 if (!animation_player_->layer_id()) 194 if (!animation_player_->layer_id())
192 animation_player_->AttachLayer(layer_id); 195 animation_player_->AttachLayer(layer_id);
193 else 196 else
194 DCHECK_EQ(animation_player_->layer_id(), layer_id); 197 DCHECK_EQ(animation_player_->layer_id(), layer_id);
195 198
196 if (animation_player_->element_animations()) { 199 if (animation_player_->element_animations()) {
197 animation_player_->element_animations() 200 animation_player_->element_animations()
198 ->layer_animation_controller()
199 ->AddEventObserver(this); 201 ->AddEventObserver(this);
200 } 202 }
201 } 203 }
202 204
203 void LayerAnimator::DetachLayerFromAnimationPlayer() { 205 void LayerAnimator::DetachLayerFromAnimationPlayer() {
204 if (animation_player_->element_animations()) { 206 if (animation_player_->element_animations()) {
205 animation_player_->element_animations() 207 animation_player_->element_animations()
206 ->layer_animation_controller()
207 ->RemoveEventObserver(this); 208 ->RemoveEventObserver(this);
208 } 209 }
209 210
210 if (animation_player_->layer_id()) 211 if (animation_player_->layer_id())
211 animation_player_->DetachLayer(); 212 animation_player_->DetachLayer();
212 } 213 }
213 214
214 void LayerAnimator::AddThreadedAnimation( 215 void LayerAnimator::AddThreadedAnimation(
215 std::unique_ptr<cc::Animation> animation) { 216 std::unique_ptr<cc::Animation> animation) {
216 animation_player_->AddAnimation(std::move(animation)); 217 animation_player_->AddAnimation(std::move(animation));
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 const base::WeakPtr<LayerAnimationSequence>& sequence) 964 const base::WeakPtr<LayerAnimationSequence>& sequence)
964 : sequence_(sequence) { 965 : sequence_(sequence) {
965 } 966 }
966 967
967 LayerAnimator::RunningAnimation::RunningAnimation( 968 LayerAnimator::RunningAnimation::RunningAnimation(
968 const RunningAnimation& other) = default; 969 const RunningAnimation& other) = default;
969 970
970 LayerAnimator::RunningAnimation::~RunningAnimation() { } 971 LayerAnimator::RunningAnimation::~RunningAnimation() { }
971 972
972 } // namespace ui 973 } // namespace ui
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host_unittest_animation.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698