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

Unified Diff: cc/animation_registrar.h

Issue 11598005: Ref count layer 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..8799022aa34652ea0a1c7e1d23ce3adee4aa97a5
--- /dev/null
+++ b/cc/animation_registrar.h
@@ -0,0 +1,65 @@
+// 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 "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "cc/cc_export.h"
+
+namespace cc {
+
+class LayerAnimationController;
+
+class CC_EXPORT AnimationRegistrar {
+ public:
+ typedef base::hash_map<int, LayerAnimationController*> AnimationControllerMap;
+
+ static scoped_ptr<AnimationRegistrar> create() {
+ return make_scoped_ptr(new AnimationRegistrar());
+ }
+
+ virtual ~AnimationRegistrar();
+
+ // If an animation has been registered for the given id, return it. Otherwise
+ // creates a new one and returns a scoped_refptr to it.
+ scoped_refptr<LayerAnimationController> GetAnimationControllerForId(int id);
+
+ // Registers the given animation controller as active. An active animation
+ // controller is one that has a running animation that needs to be ticked.
+ void DidActivateAnimationController(LayerAnimationController*);
+
+ // 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.
+ void DidDeactivateAnimationController(LayerAnimationController*);
+
+ // Registers the given controller as alive.
+ void RegisterAnimationController(LayerAnimationController*);
+
+ // Unregisters the given controller as alive.
+ void UnregisterAnimationController(LayerAnimationController*);
+
+ const AnimationControllerMap& active_animation_controllers() const {
+ return active_animation_controllers_;
+ }
+
+ const AnimationControllerMap& all_animation_controllers() const {
+ return all_animation_controllers_;
+ }
+
+ private:
+ AnimationRegistrar();
+
+ AnimationControllerMap active_animation_controllers_;
+ AnimationControllerMap all_animation_controllers_;
+
+ DISALLOW_COPY_AND_ASSIGN(AnimationRegistrar);
+};
+
+} // 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