Chromium Code Reviews| 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; | |
|
jamesr
2012/12/05 19:19:29
no indent here
| |
| 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 Activate(LayerAnimationController*, ThreadName); | |
| 37 | |
| 38 // Unregisters the given animation controller. When this happens, the | |
| 39 // animation controller will no longer be ticked (since it's not active). It | |
| 40 // is not an error to call this function with a deactivated controller. | |
| 41 static void Deactivate(LayerAnimationController*, ThreadName); | |
| 42 | |
| 43 // Registers the given animation controller as alive. | |
| 44 static void Register(LayerAnimationController*, ThreadName); | |
| 45 | |
| 46 // Unregisters the given animation controller as alive. | |
| 47 static void Unregister(LayerAnimationController*, ThreadName); | |
| 48 | |
| 49 // Gets the list of active animation controllers for the given thread. | |
| 50 static const AnimationControllerSet& GetActiveControllers(ThreadName); | |
| 51 | |
| 52 // Gets the list of all animation controllers for the given thread. | |
| 53 static const AnimationControllerSet& GetAllControllers(ThreadName); | |
| 54 }; | |
| 55 | |
| 56 } // namespace cc | |
| 57 | |
| 58 #endif // CC_ANIMATION_REGISTRAR_H_ | |
| OLD | NEW |