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

Side by Side 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 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 "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_
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