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

Side by Side Diff: cc/animation/layer_animation_controller.h

Issue 1882733005: CC Animation: Make LayerAnimationController to have just one value observer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@privatelac
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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 5 #ifndef CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 6 #define CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
7 7
8 #include <bitset> 8 #include <bitset>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 void SetAnimationHost(AnimationHost* host); 95 void SetAnimationHost(AnimationHost* host);
96 AnimationHost* animation_host() { return host_; } 96 AnimationHost* animation_host() { return host_; }
97 97
98 void NotifyAnimationStarted(const AnimationEvent& event); 98 void NotifyAnimationStarted(const AnimationEvent& event);
99 void NotifyAnimationFinished(const AnimationEvent& event); 99 void NotifyAnimationFinished(const AnimationEvent& event);
100 void NotifyAnimationAborted(const AnimationEvent& event); 100 void NotifyAnimationAborted(const AnimationEvent& event);
101 void NotifyAnimationPropertyUpdate(const AnimationEvent& event); 101 void NotifyAnimationPropertyUpdate(const AnimationEvent& event);
102 void NotifyAnimationTakeover(const AnimationEvent& event); 102 void NotifyAnimationTakeover(const AnimationEvent& event);
103 103
104 void AddValueObserver(LayerAnimationValueObserver* observer); 104 void SetValueObserver(LayerAnimationValueObserver* observer) {
ajuma 2016/04/14 14:01:18 Nit: set_value_observer
loyso (OOO) 2016/04/15 03:32:21 I can make it out-of-line to comply with the namin
loyso (OOO) 2016/04/15 03:53:27 Done.
105 void RemoveValueObserver(LayerAnimationValueObserver* observer); 105 value_observer_ = observer;
106 }
107
108 bool needs_active_value_observations() const {
109 return needs_active_value_observations_;
110 }
111 bool needs_pending_value_observations() const {
112 return needs_pending_value_observations_;
113 }
114
115 void SetNeedsActiveValueObservations(bool needs_active_value_observations) {
ajuma 2016/04/14 14:01:17 set_needs_active_value_observations
loyso (OOO) 2016/04/15 03:53:27 Done.
116 needs_active_value_observations_ = needs_active_value_observations;
117 }
118 void SetNeedsPendingValueObservations(bool needs_pending_value_observations) {
ajuma 2016/04/14 14:01:17 set_needs_pending_value_observations
loyso (OOO) 2016/04/15 03:53:26 Done.
119 needs_pending_value_observations_ = needs_pending_value_observations;
120 }
106 121
107 void AddEventObserver(LayerAnimationEventObserver* observer); 122 void AddEventObserver(LayerAnimationEventObserver* observer);
108 void RemoveEventObserver(LayerAnimationEventObserver* observer); 123 void RemoveEventObserver(LayerAnimationEventObserver* observer);
109 124
110 void set_value_provider(LayerAnimationValueProvider* provider) { 125 void set_value_provider(LayerAnimationValueProvider* provider) {
111 value_provider_ = provider; 126 value_provider_ = provider;
112 } 127 }
113 128
114 void remove_value_provider(LayerAnimationValueProvider* provider) { 129 void remove_value_provider(LayerAnimationValueProvider* provider) {
115 if (value_provider_ == provider) 130 if (value_provider_ == provider)
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 243
229 AnimationHost* host_; 244 AnimationHost* host_;
230 int id_; 245 int id_;
231 std::vector<std::unique_ptr<Animation>> animations_; 246 std::vector<std::unique_ptr<Animation>> animations_;
232 247
233 // This is used to ensure that we don't spam the animation host. 248 // This is used to ensure that we don't spam the animation host.
234 bool is_active_; 249 bool is_active_;
235 250
236 base::TimeTicks last_tick_time_; 251 base::TimeTicks last_tick_time_;
237 252
238 base::ObserverList<LayerAnimationValueObserver> value_observers_;
239 base::ObserverList<LayerAnimationEventObserver> event_observers_; 253 base::ObserverList<LayerAnimationEventObserver> event_observers_;
254 LayerAnimationValueObserver* value_observer_;
255 LayerAnimationValueProvider* value_provider_;
256 AnimationDelegate* layer_animation_delegate_;
240 257
241 LayerAnimationValueProvider* value_provider_; 258 bool needs_active_value_observations_;
242 259 bool needs_pending_value_observations_;
243 AnimationDelegate* layer_animation_delegate_;
244 260
245 // Only try to start animations when new animations are added or when the 261 // Only try to start animations when new animations are added or when the
246 // previous attempt at starting animations failed to start all animations. 262 // previous attempt at starting animations failed to start all animations.
247 bool needs_to_start_animations_; 263 bool needs_to_start_animations_;
248 264
249 bool scroll_offset_animation_was_interrupted_; 265 bool scroll_offset_animation_was_interrupted_;
250 266
251 bool potentially_animating_transform_for_active_observers_; 267 bool potentially_animating_transform_for_active_observers_;
252 bool potentially_animating_transform_for_pending_observers_; 268 bool potentially_animating_transform_for_pending_observers_;
253 269
254 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); 270 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController);
255 }; 271 };
256 272
257 } // namespace cc 273 } // namespace cc
258 274
259 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 275 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698