| OLD | NEW |
| 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 <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/macros.h" | 12 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "cc/animation/animation.h" | 16 #include "cc/animation/animation.h" |
| 17 #include "cc/animation/layer_animation_event_observer.h" | 17 #include "cc/animation/layer_animation_event_observer.h" |
| 18 #include "cc/animation/target_property.h" | 18 #include "cc/animation/target_property.h" |
| 19 #include "cc/base/cc_export.h" | 19 #include "cc/base/cc_export.h" |
| 20 #include "ui/gfx/geometry/scroll_offset.h" | 20 #include "ui/gfx/geometry/scroll_offset.h" |
| 21 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
| 22 | 22 |
| 23 namespace gfx { | 23 namespace gfx { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 37 | 37 |
| 38 class CC_EXPORT LayerAnimationController | 38 class CC_EXPORT LayerAnimationController |
| 39 : public base::RefCounted<LayerAnimationController> { | 39 : public base::RefCounted<LayerAnimationController> { |
| 40 public: | 40 public: |
| 41 enum class ObserverType { ACTIVE, PENDING }; | 41 enum class ObserverType { ACTIVE, PENDING }; |
| 42 | 42 |
| 43 static scoped_refptr<LayerAnimationController> Create(int id); | 43 static scoped_refptr<LayerAnimationController> Create(int id); |
| 44 | 44 |
| 45 int id() const { return id_; } | 45 int id() const { return id_; } |
| 46 | 46 |
| 47 void AddAnimation(scoped_ptr<Animation> animation); | 47 void AddAnimation(std::unique_ptr<Animation> animation); |
| 48 void PauseAnimation(int animation_id, base::TimeDelta time_offset); | 48 void PauseAnimation(int animation_id, base::TimeDelta time_offset); |
| 49 void RemoveAnimation(int animation_id); | 49 void RemoveAnimation(int animation_id); |
| 50 void AbortAnimation(int animation_id); | 50 void AbortAnimation(int animation_id); |
| 51 void AbortAnimations(TargetProperty::Type target_property, | 51 void AbortAnimations(TargetProperty::Type target_property, |
| 52 bool needs_completion = false); | 52 bool needs_completion = false); |
| 53 | 53 |
| 54 // Ensures that the list of active animations on the main thread and the impl | 54 // Ensures that the list of active animations on the main thread and the impl |
| 55 // thread are kept in sync. This function does not take ownership of the impl | 55 // thread are kept in sync. This function does not take ownership of the impl |
| 56 // thread controller. | 56 // thread controller. |
| 57 void PushAnimationUpdatesTo(LayerAnimationController* controller_impl); | 57 void PushAnimationUpdatesTo(LayerAnimationController* controller_impl); |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 bool notify_active_observers, | 221 bool notify_active_observers, |
| 222 bool notify_pending_observers); | 222 bool notify_pending_observers); |
| 223 | 223 |
| 224 void UpdatePotentiallyAnimatingTransform(); | 224 void UpdatePotentiallyAnimatingTransform(); |
| 225 | 225 |
| 226 bool HasValueObserver(); | 226 bool HasValueObserver(); |
| 227 bool HasActiveValueObserver(); | 227 bool HasActiveValueObserver(); |
| 228 | 228 |
| 229 AnimationRegistrar* registrar_; | 229 AnimationRegistrar* registrar_; |
| 230 int id_; | 230 int id_; |
| 231 std::vector<scoped_ptr<Animation>> animations_; | 231 std::vector<std::unique_ptr<Animation>> animations_; |
| 232 | 232 |
| 233 // This is used to ensure that we don't spam the registrar. | 233 // This is used to ensure that we don't spam the registrar. |
| 234 bool is_active_; | 234 bool is_active_; |
| 235 | 235 |
| 236 base::TimeTicks last_tick_time_; | 236 base::TimeTicks last_tick_time_; |
| 237 | 237 |
| 238 base::ObserverList<LayerAnimationValueObserver> value_observers_; | 238 base::ObserverList<LayerAnimationValueObserver> value_observers_; |
| 239 base::ObserverList<LayerAnimationEventObserver> event_observers_; | 239 base::ObserverList<LayerAnimationEventObserver> event_observers_; |
| 240 | 240 |
| 241 LayerAnimationValueProvider* value_provider_; | 241 LayerAnimationValueProvider* value_provider_; |
| 242 | 242 |
| 243 AnimationDelegate* layer_animation_delegate_; | 243 AnimationDelegate* layer_animation_delegate_; |
| 244 | 244 |
| 245 // Only try to start animations when new animations are added or when the | 245 // Only try to start animations when new animations are added or when the |
| 246 // previous attempt at starting animations failed to start all animations. | 246 // previous attempt at starting animations failed to start all animations. |
| 247 bool needs_to_start_animations_; | 247 bool needs_to_start_animations_; |
| 248 | 248 |
| 249 bool scroll_offset_animation_was_interrupted_; | 249 bool scroll_offset_animation_was_interrupted_; |
| 250 | 250 |
| 251 bool potentially_animating_transform_for_active_observers_; | 251 bool potentially_animating_transform_for_active_observers_; |
| 252 bool potentially_animating_transform_for_pending_observers_; | 252 bool potentially_animating_transform_for_pending_observers_; |
| 253 | 253 |
| 254 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); | 254 DISALLOW_COPY_AND_ASSIGN(LayerAnimationController); |
| 255 }; | 255 }; |
| 256 | 256 |
| 257 } // namespace cc | 257 } // namespace cc |
| 258 | 258 |
| 259 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ | 259 #endif // CC_ANIMATION_LAYER_ANIMATION_CONTROLLER_H_ |
| OLD | NEW |