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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | cc/animation_registrar.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "cc/cc_export.h"
12
13 namespace cc {
14
15 class LayerAnimationController;
16
17 class CC_EXPORT AnimationRegistrar {
18 public:
19 typedef base::hash_map<int, LayerAnimationController*> AnimationControllerMap;
20
21 static scoped_ptr<AnimationRegistrar> create() {
22 return make_scoped_ptr(new AnimationRegistrar());
23 }
24
25 virtual ~AnimationRegistrar();
26
27 // If an animation has been registered for the given id, return it. Otherwise
28 // creates a new one and returns a scoped_refptr to it.
29 scoped_refptr<LayerAnimationController> GetAnimationControllerForId(int id);
30
31 // Registers the given animation controller as active. An active animation
32 // controller is one that has a running animation that needs to be ticked.
33 void DidActivateAnimationController(LayerAnimationController*);
34
35 // Unregisters the given animation controller. When this happens, the
36 // 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 void DidDeactivateAnimationController(LayerAnimationController*);
39
40 // Registers the given controller as alive.
41 void RegisterAnimationController(LayerAnimationController*);
42
43 // Unregisters the given controller as alive.
44 void UnregisterAnimationController(LayerAnimationController*);
45
46 const AnimationControllerMap& active_animation_controllers() const {
47 return active_animation_controllers_;
48 }
49
50 const AnimationControllerMap& all_animation_controllers() const {
51 return all_animation_controllers_;
52 }
53
54 private:
55 AnimationRegistrar();
56
57 AnimationControllerMap active_animation_controllers_;
58 AnimationControllerMap all_animation_controllers_;
59
60 DISALLOW_COPY_AND_ASSIGN(AnimationRegistrar);
61 };
62
63 } // namespace cc
64
65 #endif // CC_ANIMATION_REGISTRAR_H_
OLDNEW
« 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