OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_TREES_LAYER_TREE_H_ | 5 #ifndef CC_TREES_LAYER_TREE_H_ |
6 #define CC_TREES_LAYER_TREE_H_ | 6 #define CC_TREES_LAYER_TREE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <unordered_map> | 9 #include <unordered_map> |
10 #include <unordered_set> | 10 #include <unordered_set> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "cc/input/event_listener_properties.h" | 15 #include "cc/input/event_listener_properties.h" |
16 #include "cc/input/layer_selection_bound.h" | 16 #include "cc/input/layer_selection_bound.h" |
17 #include "cc/layers/layer_collections.h" | 17 #include "cc/layers/layer_collections.h" |
18 #include "cc/layers/layer_list_iterator.h" | 18 #include "cc/layers/layer_list_iterator.h" |
19 #include "cc/trees/mutator_host_client.h" | 19 #include "cc/trees/mutator_host_client.h" |
20 #include "cc/trees/property_tree.h" | 20 #include "cc/trees/property_tree.h" |
21 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
22 #include "ui/gfx/color_space.h" | 22 #include "ui/gfx/color_space.h" |
23 #include "ui/gfx/geometry/size.h" | 23 #include "ui/gfx/geometry/size.h" |
24 | 24 |
25 namespace base { | 25 namespace base { |
26 class TimeDelta; | 26 class TimeDelta; |
27 } // namespace base | 27 } // namespace base |
28 | 28 |
29 namespace cc { | 29 namespace cc { |
30 | |
31 namespace proto { | |
32 class LayerTree; | |
33 } // namespace proto | |
34 | |
35 class ClientPictureCache; | |
36 class EnginePictureCache; | |
37 class HeadsUpDisplayLayer; | 30 class HeadsUpDisplayLayer; |
38 class Layer; | 31 class Layer; |
39 class LayerTreeHost; | 32 class LayerTreeHost; |
40 class LayerTreeImpl; | 33 class LayerTreeImpl; |
41 class LayerTreeSettings; | 34 class LayerTreeSettings; |
42 class MutatorHost; | 35 class MutatorHost; |
43 struct PendingPageScaleAnimation; | 36 struct PendingPageScaleAnimation; |
44 | 37 |
45 class CC_EXPORT LayerTree : public MutatorHostClient { | 38 class CC_EXPORT LayerTree : public MutatorHostClient { |
46 public: | 39 public: |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 void RemoveLayerShouldPushProperties(Layer* layer); | 148 void RemoveLayerShouldPushProperties(Layer* layer); |
156 std::unordered_set<Layer*>& LayersThatShouldPushProperties(); | 149 std::unordered_set<Layer*>& LayersThatShouldPushProperties(); |
157 bool LayerNeedsPushPropertiesForTesting(Layer* layer) const; | 150 bool LayerNeedsPushPropertiesForTesting(Layer* layer) const; |
158 | 151 |
159 virtual void SetNeedsMetaInfoRecomputation( | 152 virtual void SetNeedsMetaInfoRecomputation( |
160 bool needs_meta_info_recomputation); | 153 bool needs_meta_info_recomputation); |
161 bool needs_meta_info_recomputation() const { | 154 bool needs_meta_info_recomputation() const { |
162 return needs_meta_info_recomputation_; | 155 return needs_meta_info_recomputation_; |
163 } | 156 } |
164 | 157 |
165 void set_engine_picture_cache(EnginePictureCache* cache) { | |
166 engine_picture_cache_ = cache; | |
167 } | |
168 EnginePictureCache* engine_picture_cache() const { | |
169 return engine_picture_cache_; | |
170 } | |
171 void set_client_picture_cache(ClientPictureCache* cache) { | |
172 client_picture_cache_ = cache; | |
173 } | |
174 ClientPictureCache* client_picture_cache() const { | |
175 return client_picture_cache_; | |
176 } | |
177 | |
178 void SetPageScaleFromImplSide(float page_scale); | 158 void SetPageScaleFromImplSide(float page_scale); |
179 void SetElasticOverscrollFromImplSide(gfx::Vector2dF elastic_overscroll); | 159 void SetElasticOverscrollFromImplSide(gfx::Vector2dF elastic_overscroll); |
180 gfx::Vector2dF elastic_overscroll() const { return elastic_overscroll_; } | 160 gfx::Vector2dF elastic_overscroll() const { return elastic_overscroll_; } |
181 | 161 |
182 void UpdateHudLayer(bool show_hud_info); | 162 void UpdateHudLayer(bool show_hud_info); |
183 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } | 163 HeadsUpDisplayLayer* hud_layer() const { return hud_layer_.get(); } |
184 | 164 |
185 virtual void SetNeedsFullTreeSync(); | 165 virtual void SetNeedsFullTreeSync(); |
186 bool needs_full_tree_sync() const { return needs_full_tree_sync_; } | 166 bool needs_full_tree_sync() const { return needs_full_tree_sync_; } |
187 | 167 |
188 void SetPropertyTreesNeedRebuild(); | 168 void SetPropertyTreesNeedRebuild(); |
189 | 169 |
190 void PushPropertiesTo(LayerTreeImpl* tree_impl, | 170 void PushPropertiesTo(LayerTreeImpl* tree_impl, |
191 float unapplied_page_scale_delta); | 171 float unapplied_page_scale_delta); |
192 | 172 |
193 void ToProtobuf(proto::LayerTree* proto); | |
194 | |
195 MutatorHost* mutator_host() const { return mutator_host_; } | 173 MutatorHost* mutator_host() const { return mutator_host_; } |
196 | 174 |
197 Layer* LayerByElementId(ElementId element_id) const; | 175 Layer* LayerByElementId(ElementId element_id) const; |
198 void RegisterElement(ElementId element_id, | 176 void RegisterElement(ElementId element_id, |
199 ElementListType list_type, | 177 ElementListType list_type, |
200 Layer* layer); | 178 Layer* layer); |
201 void UnregisterElement(ElementId element_id, | 179 void UnregisterElement(ElementId element_id, |
202 ElementListType list_type, | 180 ElementListType list_type, |
203 Layer* layer); | 181 Layer* layer); |
204 void SetElementIdsForTesting(); | 182 void SetElementIdsForTesting(); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 LayerIdMap layer_id_map_; | 276 LayerIdMap layer_id_map_; |
299 | 277 |
300 using ElementLayersMap = std::unordered_map<ElementId, Layer*, ElementIdHash>; | 278 using ElementLayersMap = std::unordered_map<ElementId, Layer*, ElementIdHash>; |
301 ElementLayersMap element_layers_map_; | 279 ElementLayersMap element_layers_map_; |
302 | 280 |
303 bool in_paint_layer_contents_; | 281 bool in_paint_layer_contents_; |
304 | 282 |
305 MutatorHost* mutator_host_; | 283 MutatorHost* mutator_host_; |
306 LayerTreeHost* layer_tree_host_; | 284 LayerTreeHost* layer_tree_host_; |
307 | 285 |
308 // TODO(khushalsagar): Make these go away once we transition blimp to an | |
309 // external embedder. | |
310 EnginePictureCache* engine_picture_cache_; | |
311 ClientPictureCache* client_picture_cache_; | |
312 | |
313 DISALLOW_COPY_AND_ASSIGN(LayerTree); | 286 DISALLOW_COPY_AND_ASSIGN(LayerTree); |
314 }; | 287 }; |
315 | 288 |
316 } // namespace cc | 289 } // namespace cc |
317 | 290 |
318 #endif // CC_TREES_LAYER_TREE_H_ | 291 #endif // CC_TREES_LAYER_TREE_H_ |
OLD | NEW |