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_ANIMATION_REGISTRAR_H_ | 5 #ifndef CC_ANIMATION_ANIMATION_REGISTRAR_H_ |
6 #define CC_ANIMATION_ANIMATION_REGISTRAR_H_ | 6 #define CC_ANIMATION_ANIMATION_REGISTRAR_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "cc/animation/animation_events.h" |
11 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
15 class LayerAnimationController; | 16 class LayerAnimationController; |
16 | 17 |
17 class CC_EXPORT AnimationRegistrar { | 18 class CC_EXPORT AnimationRegistrar { |
18 public: | 19 public: |
19 typedef base::hash_map<int, LayerAnimationController*> AnimationControllerMap; | 20 typedef base::hash_map<int, LayerAnimationController*> AnimationControllerMap; |
20 | 21 |
(...skipping 15 matching lines...) Expand all Loading... |
36 // animation controller will no longer be ticked (since it's not active). It | 37 // animation controller will no longer be ticked (since it's not active). It |
37 // is not an error to call this function with a deactivated controller. | 38 // is not an error to call this function with a deactivated controller. |
38 void DidDeactivateAnimationController(LayerAnimationController* controller); | 39 void DidDeactivateAnimationController(LayerAnimationController* controller); |
39 | 40 |
40 // Registers the given controller as alive. | 41 // Registers the given controller as alive. |
41 void RegisterAnimationController(LayerAnimationController* controller); | 42 void RegisterAnimationController(LayerAnimationController* controller); |
42 | 43 |
43 // Unregisters the given controller as alive. | 44 // Unregisters the given controller as alive. |
44 void UnregisterAnimationController(LayerAnimationController* controller); | 45 void UnregisterAnimationController(LayerAnimationController* controller); |
45 | 46 |
46 const AnimationControllerMap& active_animation_controllers() const { | 47 const AnimationControllerMap& active_animation_controllers_for_testing() |
| 48 const { |
47 return active_animation_controllers_; | 49 return active_animation_controllers_; |
48 } | 50 } |
49 | 51 |
50 const AnimationControllerMap& all_animation_controllers() const { | 52 const AnimationControllerMap& all_animation_controllers_for_testing() const { |
51 return all_animation_controllers_; | 53 return all_animation_controllers_; |
52 } | 54 } |
53 | 55 |
54 void set_supports_scroll_animations(bool supports_scroll_animations) { | 56 void set_supports_scroll_animations(bool supports_scroll_animations) { |
55 supports_scroll_animations_ = supports_scroll_animations; | 57 supports_scroll_animations_ = supports_scroll_animations; |
56 } | 58 } |
57 | 59 |
58 bool supports_scroll_animations() { return supports_scroll_animations_; } | 60 bool supports_scroll_animations() { return supports_scroll_animations_; } |
59 | 61 |
| 62 bool needs_animate_layers() const { |
| 63 return !active_animation_controllers_.empty(); |
| 64 } |
| 65 |
| 66 bool ActivateAnimations(); |
| 67 bool AnimateLayers(base::TimeTicks monotonic_time); |
| 68 bool UpdateAnimationState(bool start_ready_animations, |
| 69 AnimationEventsVector* events); |
| 70 |
| 71 scoped_ptr<AnimationEventsVector> CreateEvents() { |
| 72 return make_scoped_ptr(new AnimationEventsVector()); |
| 73 } |
| 74 |
| 75 void SetAnimationEvents(scoped_ptr<AnimationEventsVector> events); |
| 76 |
60 private: | 77 private: |
61 AnimationRegistrar(); | 78 AnimationRegistrar(); |
62 | 79 |
63 AnimationControllerMap active_animation_controllers_; | 80 AnimationControllerMap active_animation_controllers_; |
64 AnimationControllerMap all_animation_controllers_; | 81 AnimationControllerMap all_animation_controllers_; |
65 | 82 |
66 bool supports_scroll_animations_; | 83 bool supports_scroll_animations_; |
67 | 84 |
68 DISALLOW_COPY_AND_ASSIGN(AnimationRegistrar); | 85 DISALLOW_COPY_AND_ASSIGN(AnimationRegistrar); |
69 }; | 86 }; |
70 | 87 |
71 } // namespace cc | 88 } // namespace cc |
72 | 89 |
73 #endif // CC_ANIMATION_ANIMATION_REGISTRAR_H_ | 90 #endif // CC_ANIMATION_ANIMATION_REGISTRAR_H_ |
OLD | NEW |