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

Side by Side Diff: cc/layer_tree_impl.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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_LAYER_TREE_IMPL_H_ 5 #ifndef CC_LAYER_TREE_IMPL_H_
6 #define CC_LAYER_TREE_IMPL_H_ 6 #define CC_LAYER_TREE_IMPL_H_
7 7
8 #include "base/hash_tables.h" 8 #include "base/hash_tables.h"
9 #include "cc/animation_registrar.h"
9 #include "cc/layer_impl.h" 10 #include "cc/layer_impl.h"
10 11
11 #if defined(COMPILER_GCC) 12 #if defined(COMPILER_GCC)
12 namespace BASE_HASH_NAMESPACE { 13 namespace BASE_HASH_NAMESPACE {
13 template<> 14 template<>
14 struct hash<cc::LayerImpl*> { 15 struct hash<cc::LayerImpl*> {
15 size_t operator()(cc::LayerImpl* ptr) const { 16 size_t operator()(cc::LayerImpl* ptr) const {
16 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); 17 return hash<size_t>()(reinterpret_cast<size_t>(ptr));
17 } 18 }
18 }; 19 };
19 } // namespace BASE_HASH_NAMESPACE 20 } // namespace BASE_HASH_NAMESPACE
20 #endif // COMPILER 21 #endif // COMPILER
21 22
22 namespace cc { 23 namespace cc {
23 24
24 class DebugRectHistory; 25 class DebugRectHistory;
25 class FrameRateCounter; 26 class FrameRateCounter;
26 class HeadsUpDisplayLayerImpl; 27 class HeadsUpDisplayLayerImpl;
27 class LayerTreeDebugState; 28 class LayerTreeDebugState;
28 class LayerTreeHostImpl; 29 class LayerTreeHostImpl;
29 class LayerTreeImpl; 30 class LayerTreeImpl;
30 class LayerTreeSettings; 31 class LayerTreeSettings;
31 class OutputSurface; 32 class OutputSurface;
32 class ResourceProvider; 33 class ResourceProvider;
33 class TileManager; 34 class TileManager;
34 35
35 class CC_EXPORT LayerTreeImpl { 36 class CC_EXPORT LayerTreeImpl : public AnimationRegistrar {
36 public: 37 public:
37 static scoped_ptr<LayerTreeImpl> create(LayerTreeHostImpl* layer_tree_host_imp l) 38 static scoped_ptr<LayerTreeImpl> create(LayerTreeHostImpl* layer_tree_host_imp l)
38 { 39 {
39 return make_scoped_ptr(new LayerTreeImpl(layer_tree_host_impl)); 40 return make_scoped_ptr(new LayerTreeImpl(layer_tree_host_impl));
40 } 41 }
41 virtual ~LayerTreeImpl(); 42 virtual ~LayerTreeImpl();
42 43
43 // Methods called by the layer tree that pass-through or access LTHI. 44 // Methods called by the layer tree that pass-through or access LTHI.
44 // --------------------------------------------------------------------------- 45 // ---------------------------------------------------------------------------
45 const LayerTreeSettings& settings() const; 46 const LayerTreeSettings& settings() const;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 89
89 LayerImpl* LayerById(int id); 90 LayerImpl* LayerById(int id);
90 91
91 // These should be called by LayerImpl's ctor/dtor. 92 // These should be called by LayerImpl's ctor/dtor.
92 void RegisterLayer(LayerImpl* layer); 93 void RegisterLayer(LayerImpl* layer);
93 void UnregisterLayer(LayerImpl* layer); 94 void UnregisterLayer(LayerImpl* layer);
94 95
95 protected: 96 protected:
96 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); 97 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl);
97 98
99 // AnimationRegistrar implementation.
100 virtual scoped_refptr<LayerAnimationController> GetAnimationControllerForId(in t id) OVERRIDE;
101 virtual void DidActivateAnimationController(LayerAnimationController*) OVERRID E;
102 virtual void DidDeactivateAnimationController(LayerAnimationController*) OVERR IDE;
103 virtual void RegisterAnimationController(LayerAnimationController*) OVERRIDE;
104 virtual void UnregisterAnimationController(LayerAnimationController*) OVERRIDE ;
105
98 LayerTreeHostImpl* layer_tree_host_impl_; 106 LayerTreeHostImpl* layer_tree_host_impl_;
99 int source_frame_number_; 107 int source_frame_number_;
100 scoped_ptr<LayerImpl> root_layer_; 108 scoped_ptr<LayerImpl> root_layer_;
101 HeadsUpDisplayLayerImpl* hud_layer_; 109 HeadsUpDisplayLayerImpl* hud_layer_;
102 LayerImpl* root_scroll_layer_; 110 LayerImpl* root_scroll_layer_;
103 LayerImpl* currently_scrolling_layer_; 111 LayerImpl* currently_scrolling_layer_;
104 112
105 typedef base::hash_map<int, LayerImpl*> LayerIdMap; 113 typedef base::hash_map<int, LayerImpl*> LayerIdMap;
106 LayerIdMap layer_id_map_; 114 LayerIdMap layer_id_map_;
107 115
108 // Persisted state 116 // Persisted state
109 int scrolling_layer_id_from_previous_tree_; 117 int scrolling_layer_id_from_previous_tree_;
110 118
111 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); 119 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl);
112 }; 120 };
113 121
114 } 122 }
115 123
116 #endif // CC_LAYER_TREE_IMPL_H_ 124 #endif // CC_LAYER_TREE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698