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

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

Issue 231133002: CC::Animations should use TimeTicks & TimeDelta to represent time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self review changes. Created 6 years, 7 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 "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 22 matching lines...) Expand all
33 class LayerAnimationValueProvider; 33 class LayerAnimationValueProvider;
34 34
35 class CC_EXPORT LayerAnimationController 35 class CC_EXPORT LayerAnimationController
36 : public base::RefCounted<LayerAnimationController> { 36 : public base::RefCounted<LayerAnimationController> {
37 public: 37 public:
38 static scoped_refptr<LayerAnimationController> Create(int id); 38 static scoped_refptr<LayerAnimationController> Create(int id);
39 39
40 int id() const { return id_; } 40 int id() const { return id_; }
41 41
42 void AddAnimation(scoped_ptr<Animation> animation); 42 void AddAnimation(scoped_ptr<Animation> animation);
43 void PauseAnimation(int animation_id, double time_offset); 43 void PauseAnimation(int animation_id, base::TimeDelta time_offset);
44 void RemoveAnimation(int animation_id); 44 void RemoveAnimation(int animation_id);
45 void RemoveAnimation(int animation_id, 45 void RemoveAnimation(int animation_id,
46 Animation::TargetProperty target_property); 46 Animation::TargetProperty target_property);
47 void AbortAnimations(Animation::TargetProperty target_property); 47 void AbortAnimations(Animation::TargetProperty target_property);
48 48
49 // Ensures that the list of active animations on the main thread and the impl 49 // Ensures that the list of active animations on the main thread and the impl
50 // thread are kept in sync. This function does not take ownership of the impl 50 // thread are kept in sync. This function does not take ownership of the impl
51 // thread controller. This method is virtual for testing. 51 // thread controller. This method is virtual for testing.
52 virtual void PushAnimationUpdatesTo( 52 virtual void PushAnimationUpdatesTo(
53 LayerAnimationController* controller_impl); 53 LayerAnimationController* controller_impl);
54 54
55 void Animate(double monotonic_time); 55 void Animate(base::TimeTicks monotonic_time);
56 void AccumulatePropertyUpdates(double monotonic_time, 56 void AccumulatePropertyUpdates(base::TimeTicks monotonic_time,
57 AnimationEventsVector* events); 57 AnimationEventsVector* events);
58 58
59 void UpdateState(bool start_ready_animations, 59 void UpdateState(bool start_ready_animations,
60 AnimationEventsVector* events); 60 AnimationEventsVector* events);
61 61
62 // Make animations affect active observers if and only if they affect 62 // Make animations affect active observers if and only if they affect
63 // pending observers. Any animations that no longer affect any observers 63 // pending observers. Any animations that no longer affect any observers
64 // are deleted. 64 // are deleted.
65 void ActivateAnimations(); 65 void ActivateAnimations();
66 66
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 private: 141 private:
142 typedef base::hash_set<int> TargetProperties; 142 typedef base::hash_set<int> TargetProperties;
143 143
144 void PushNewAnimationsToImplThread( 144 void PushNewAnimationsToImplThread(
145 LayerAnimationController* controller_impl) const; 145 LayerAnimationController* controller_impl) const;
146 void RemoveAnimationsCompletedOnMainThread( 146 void RemoveAnimationsCompletedOnMainThread(
147 LayerAnimationController* controller_impl) const; 147 LayerAnimationController* controller_impl) const;
148 void PushPropertiesToImplThread( 148 void PushPropertiesToImplThread(
149 LayerAnimationController* controller_impl) const; 149 LayerAnimationController* controller_impl) const;
150 150
151 void StartAnimations(double monotonic_time); 151 void StartAnimations(base::TimeTicks monotonic_time);
152 void PromoteStartedAnimations(double monotonic_time, 152 void PromoteStartedAnimations(base::TimeTicks monotonic_time,
153 AnimationEventsVector* events); 153 AnimationEventsVector* events);
154 void MarkFinishedAnimations(double monotonic_time); 154 void MarkFinishedAnimations(base::TimeTicks monotonic_time);
155 void MarkAnimationsForDeletion(double monotonic_time, 155 void MarkAnimationsForDeletion(base::TimeTicks monotonic_time,
156 AnimationEventsVector* events); 156 AnimationEventsVector* events);
157 void PurgeAnimationsMarkedForDeletion(); 157 void PurgeAnimationsMarkedForDeletion();
158 158
159 void TickAnimations(double monotonic_time); 159 void TickAnimations(base::TimeTicks monotonic_time);
160 160
161 enum UpdateActivationType { 161 enum UpdateActivationType {
162 NormalActivation, 162 NormalActivation,
163 ForceActivation 163 ForceActivation
164 }; 164 };
165 void UpdateActivation(UpdateActivationType type); 165 void UpdateActivation(UpdateActivationType type);
166 166
167 void NotifyObserversOpacityAnimated(float opacity, 167 void NotifyObserversOpacityAnimated(float opacity,
168 bool notify_active_observers, 168 bool notify_active_observers,
169 bool notify_pending_observers); 169 bool notify_pending_observers);
(...skipping 12 matching lines...) Expand all
182 bool HasValueObserver(); 182 bool HasValueObserver();
183 bool HasActiveValueObserver(); 183 bool HasActiveValueObserver();
184 184
185 AnimationRegistrar* registrar_; 185 AnimationRegistrar* registrar_;
186 int id_; 186 int id_;
187 ScopedPtrVector<Animation> animations_; 187 ScopedPtrVector<Animation> animations_;
188 188
189 // This is used to ensure that we don't spam the registrar. 189 // This is used to ensure that we don't spam the registrar.
190 bool is_active_; 190 bool is_active_;
191 191
192 double last_tick_time_; 192 base::TimeTicks last_tick_time_;
193 193
194 ObserverList<LayerAnimationValueObserver> value_observers_; 194 ObserverList<LayerAnimationValueObserver> value_observers_;
195 ObserverList<LayerAnimationEventObserver> event_observers_; 195 ObserverList<LayerAnimationEventObserver> event_observers_;
196 196
197 LayerAnimationValueProvider* value_provider_; 197 LayerAnimationValueProvider* value_provider_;
198 198
199 AnimationDelegate* layer_animation_delegate_; 199 AnimationDelegate* layer_animation_delegate_;
200 200
201 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); 201 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController);
202 }; 202 };
203 203
204 } // namespace cc 204 } // namespace cc
205 205
206 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ 206 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698