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

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

Issue 1893253002: CC Animation: Make LayerAnimationController to have just one event observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@rc
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/animation/layer_animation_controller_unittest.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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 timeline->DetachPlayer(animation_player_); 190 timeline->DetachPlayer(animation_player_);
191 } 191 }
192 192
193 void LayerAnimator::AttachLayerToAnimationPlayer(int layer_id) { 193 void LayerAnimator::AttachLayerToAnimationPlayer(int layer_id) {
194 if (!animation_player_->layer_id()) 194 if (!animation_player_->layer_id())
195 animation_player_->AttachLayer(layer_id); 195 animation_player_->AttachLayer(layer_id);
196 else 196 else
197 DCHECK_EQ(animation_player_->layer_id(), layer_id); 197 DCHECK_EQ(animation_player_->layer_id(), layer_id);
198 198
199 if (animation_player_->element_animations()) { 199 if (animation_player_->element_animations())
200 animation_player_->element_animations() 200 animation_player_->element_animations()->SetEventObserver(this);
201 ->AddEventObserver(this);
202 }
203 } 201 }
204 202
205 void LayerAnimator::DetachLayerFromAnimationPlayer() { 203 void LayerAnimator::DetachLayerFromAnimationPlayer() {
206 if (animation_player_->element_animations()) { 204 if (animation_player_->element_animations())
207 animation_player_->element_animations() 205 animation_player_->element_animations()->SetEventObserver(nullptr);
208 ->RemoveEventObserver(this);
209 }
210 206
211 if (animation_player_->layer_id()) 207 if (animation_player_->layer_id())
212 animation_player_->DetachLayer(); 208 animation_player_->DetachLayer();
213 } 209 }
214 210
215 void LayerAnimator::AddThreadedAnimation( 211 void LayerAnimator::AddThreadedAnimation(
216 std::unique_ptr<cc::Animation> animation) { 212 std::unique_ptr<cc::Animation> animation) {
217 animation_player_->AddAnimation(std::move(animation)); 213 animation_player_->AddAnimation(std::move(animation));
218 } 214 }
219 215
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 const base::WeakPtr<LayerAnimationSequence>& sequence) 960 const base::WeakPtr<LayerAnimationSequence>& sequence)
965 : sequence_(sequence) { 961 : sequence_(sequence) {
966 } 962 }
967 963
968 LayerAnimator::RunningAnimation::RunningAnimation( 964 LayerAnimator::RunningAnimation::RunningAnimation(
969 const RunningAnimation& other) = default; 965 const RunningAnimation& other) = default;
970 966
971 LayerAnimator::RunningAnimation::~RunningAnimation() { } 967 LayerAnimator::RunningAnimation::~RunningAnimation() { }
972 968
973 } // namespace ui 969 } // namespace ui
OLDNEW
« no previous file with comments | « cc/animation/layer_animation_controller_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698