OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CC_ANIMATION_REGISTRAR_H_ |
| 6 #define CC_ANIMATION_REGISTRAR_H_ |
| 7 |
| 8 #include "base/hash_tables.h" |
| 9 #include "cc/cc_export.h" |
| 10 |
| 11 namespace cc { |
| 12 class LayerAnimationController; |
| 13 } // namespace cc |
| 14 |
| 15 #if defined(COMPILER_GCC) |
| 16 namespace BASE_HASH_NAMESPACE { |
| 17 template<> |
| 18 struct hash<cc::LayerAnimationController*> { |
| 19 size_t operator()(cc::LayerAnimationController* ptr) const { |
| 20 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); |
| 21 } |
| 22 }; |
| 23 } // namespace BASE_HASH_NAMESPACE |
| 24 #endif // COMPILER |
| 25 |
| 26 namespace cc { |
| 27 |
| 28 class CC_EXPORT AnimationRegistrar { |
| 29 public: |
| 30 typedef base::hash_set<LayerAnimationController*> AnimationControllerSet; |
| 31 |
| 32 enum ThreadName { MainThread, CompositorThread }; |
| 33 |
| 34 // Registers the given animation controller as active. An active animation |
| 35 // controller is one that has a running animation that needs to be ticked. |
| 36 static void ActivateAnimationController(LayerAnimationController*, |
| 37 ThreadName); |
| 38 |
| 39 // Unregisters the given animation controller. When this happens, the |
| 40 // animation controller will no longer be ticked (since it's not active). It |
| 41 // is not an error to call this function with a deactivated controller. |
| 42 static void DeactivateAnimationController(LayerAnimationController*, |
| 43 ThreadName); |
| 44 |
| 45 // Gets the list of active animations for the given thread. |
| 46 static const AnimationControllerSet& GetActiveControllers(ThreadName); |
| 47 }; |
| 48 |
| 49 } // namespace cc |
| 50 |
| 51 #endif // CC_ANIMATION_REGISTRAR_H_ |
OLD | NEW |