OLD | NEW |
---|---|
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 "cc/layer_impl.h" | 9 #include "cc/layer_impl.h" |
9 | 10 |
11 #if defined(COMPILER_GCC) | |
danakj
2012/12/13 23:57:11
I would expect you to need an MSVC version too. If
enne (OOO)
2012/12/14 00:21:12
Nope. That's just for std::pair being weird. See
| |
12 namespace BASE_HASH_NAMESPACE { | |
13 template<> | |
14 struct hash<cc::LayerImpl*> { | |
15 size_t operator()(cc::LayerImpl* ptr) const { | |
16 return hash<size_t>()(reinterpret_cast<size_t>(ptr)); | |
17 } | |
18 }; | |
19 } // namespace BASE_HASH_NAMESPACE | |
20 #endif // COMPILER | |
21 | |
10 namespace cc { | 22 namespace cc { |
11 | 23 |
12 class DebugRectHistory; | 24 class DebugRectHistory; |
13 class FrameRateCounter; | 25 class FrameRateCounter; |
14 class HeadsUpDisplayLayerImpl; | 26 class HeadsUpDisplayLayerImpl; |
15 class LayerTreeDebugState; | 27 class LayerTreeDebugState; |
16 class LayerTreeHostImpl; | 28 class LayerTreeHostImpl; |
17 class LayerTreeImpl; | 29 class LayerTreeImpl; |
18 class LayerTreeSettings; | 30 class LayerTreeSettings; |
19 class OutputSurface; | 31 class OutputSurface; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { hud_layer_ = layer_i mpl; } | 75 void set_hud_layer(HeadsUpDisplayLayerImpl* layer_impl) { hud_layer_ = layer_i mpl; } |
64 | 76 |
65 LayerImpl* root_scroll_layer() { return root_scroll_layer_; } | 77 LayerImpl* root_scroll_layer() { return root_scroll_layer_; } |
66 void set_root_scroll_layer(LayerImpl* layer_impl) { root_scroll_layer_ = layer _impl; } | 78 void set_root_scroll_layer(LayerImpl* layer_impl) { root_scroll_layer_ = layer _impl; } |
67 | 79 |
68 LayerImpl* currently_scrolling_layer() { return currently_scrolling_layer_; } | 80 LayerImpl* currently_scrolling_layer() { return currently_scrolling_layer_; } |
69 void set_currently_scrolling_layer(LayerImpl* layer_impl) { currently_scrollin g_layer_ = layer_impl; } | 81 void set_currently_scrolling_layer(LayerImpl* layer_impl) { currently_scrollin g_layer_ = layer_impl; } |
70 | 82 |
71 void ClearCurrentlyScrollingLayer(); | 83 void ClearCurrentlyScrollingLayer(); |
72 | 84 |
85 LayerImpl* LayerById(int id); | |
86 | |
87 // These should be called by LayerImpl's ctor/dtor. | |
88 void RegisterLayer(LayerImpl* layer); | |
89 void UnregisterLayer(LayerImpl* layer); | |
90 | |
73 protected: | 91 protected: |
74 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); | 92 LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl); |
75 | 93 |
76 LayerTreeHostImpl* layer_tree_host_impl_; | 94 LayerTreeHostImpl* layer_tree_host_impl_; |
77 int source_frame_number_; | 95 int source_frame_number_; |
78 scoped_ptr<LayerImpl> root_layer_; | 96 scoped_ptr<LayerImpl> root_layer_; |
79 HeadsUpDisplayLayerImpl* hud_layer_; | 97 HeadsUpDisplayLayerImpl* hud_layer_; |
80 LayerImpl* root_scroll_layer_; | 98 LayerImpl* root_scroll_layer_; |
81 LayerImpl* currently_scrolling_layer_; | 99 LayerImpl* currently_scrolling_layer_; |
82 | 100 |
101 typedef base::hash_map<int, LayerImpl*> LayerIdMap; | |
102 LayerIdMap layer_id_map_; | |
103 | |
83 // Persisted state | 104 // Persisted state |
84 int scrolling_layer_id_from_previous_tree_; | 105 int scrolling_layer_id_from_previous_tree_; |
85 | 106 |
86 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); | 107 DISALLOW_COPY_AND_ASSIGN(LayerTreeImpl); |
87 }; | 108 }; |
88 | 109 |
89 } | 110 } |
90 | 111 |
91 #endif // CC_LAYER_TREE_IMPL_H_ | 112 #endif // CC_LAYER_TREE_IMPL_H_ |
OLD | NEW |