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

Unified Diff: cc/animation_registrar.h

Issue 11443004: Maintain global lists of animation controllers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cc/animation_registrar.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/animation_registrar.h
diff --git a/cc/animation_registrar.h b/cc/animation_registrar.h
new file mode 100644
index 0000000000000000000000000000000000000000..2b59dba2662348feba5d768fd401bc671bc6cba6
--- /dev/null
+++ b/cc/animation_registrar.h
@@ -0,0 +1,58 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CC_ANIMATION_REGISTRAR_H_
+#define CC_ANIMATION_REGISTRAR_H_
+
+#include "base/hash_tables.h"
+#include "cc/cc_export.h"
+
+namespace cc {
+ class LayerAnimationController;
jamesr 2012/12/05 19:19:29 no indent here
+} // namespace cc
+
+#if defined(COMPILER_GCC)
+namespace BASE_HASH_NAMESPACE {
+template<>
+struct hash<cc::LayerAnimationController*> {
+ size_t operator()(cc::LayerAnimationController* ptr) const {
+ return hash<size_t>()(reinterpret_cast<size_t>(ptr));
+ }
+};
+} // namespace BASE_HASH_NAMESPACE
+#endif // COMPILER
+
+namespace cc {
+
+class CC_EXPORT AnimationRegistrar {
+ public:
+ typedef base::hash_set<LayerAnimationController*> AnimationControllerSet;
+
+ enum ThreadName { MainThread, CompositorThread };
+
+ // Registers the given animation controller as active. An active animation
+ // controller is one that has a running animation that needs to be ticked.
+ static void Activate(LayerAnimationController*, ThreadName);
+
+ // Unregisters the given animation controller. When this happens, the
+ // animation controller will no longer be ticked (since it's not active). It
+ // is not an error to call this function with a deactivated controller.
+ static void Deactivate(LayerAnimationController*, ThreadName);
+
+ // Registers the given animation controller as alive.
+ static void Register(LayerAnimationController*, ThreadName);
+
+ // Unregisters the given animation controller as alive.
+ static void Unregister(LayerAnimationController*, ThreadName);
+
+ // Gets the list of active animation controllers for the given thread.
+ static const AnimationControllerSet& GetActiveControllers(ThreadName);
+
+ // Gets the list of all animation controllers for the given thread.
+ static const AnimationControllerSet& GetAllControllers(ThreadName);
+};
+
+} // namespace cc
+
+#endif // CC_ANIMATION_REGISTRAR_H_
« no previous file with comments | « no previous file | cc/animation_registrar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698