| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 #include "cc/trees/layer_tree_impl.h" | 5 #include "cc/trees/layer_tree_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 | 257 |
| 258 void LayerTreeImpl::SetRootLayer(std::unique_ptr<LayerImpl> layer) { | 258 void LayerTreeImpl::SetRootLayer(std::unique_ptr<LayerImpl> layer) { |
| 259 if (root_layer_ && layer.get() != root_layer_) | 259 if (root_layer_ && layer.get() != root_layer_) |
| 260 RemoveLayer(root_layer_->id()); | 260 RemoveLayer(root_layer_->id()); |
| 261 root_layer_ = layer.get(); | 261 root_layer_ = layer.get(); |
| 262 if (layer) | 262 if (layer) |
| 263 AddLayer(std::move(layer)); | 263 AddLayer(std::move(layer)); |
| 264 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); | 264 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 void LayerTreeImpl::BuildLayerListForTesting() { |
| 268 layer_list_.clear(); |
| 269 LayerListIterator<LayerImpl> it(root_layer_); |
| 270 for (; it != LayerListIterator<LayerImpl>(nullptr); ++it) { |
| 271 layer_list_.push_back(*it); |
| 272 } |
| 273 } |
| 274 |
| 267 bool LayerTreeImpl::IsRootLayer(const LayerImpl* layer) const { | 275 bool LayerTreeImpl::IsRootLayer(const LayerImpl* layer) const { |
| 268 return root_layer_ == layer; | 276 return root_layer_ == layer; |
| 269 } | 277 } |
| 270 | 278 |
| 271 LayerImpl* LayerTreeImpl::InnerViewportScrollLayer() const { | 279 LayerImpl* LayerTreeImpl::InnerViewportScrollLayer() const { |
| 272 return LayerById(inner_viewport_scroll_layer_id_); | 280 return LayerById(inner_viewport_scroll_layer_id_); |
| 273 } | 281 } |
| 274 | 282 |
| 275 LayerImpl* LayerTreeImpl::OuterViewportScrollLayer() const { | 283 LayerImpl* LayerTreeImpl::OuterViewportScrollLayer() const { |
| 276 return LayerById(outer_viewport_scroll_layer_id_); | 284 return LayerById(outer_viewport_scroll_layer_id_); |
| (...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 969 | 977 |
| 970 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", | 978 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", |
| 971 "layers_updated_count", layers_updated_count); | 979 "layers_updated_count", layers_updated_count); |
| 972 } | 980 } |
| 973 | 981 |
| 974 DCHECK(!needs_update_draw_properties_) | 982 DCHECK(!needs_update_draw_properties_) |
| 975 << "CalcDrawProperties should not set_needs_update_draw_properties()"; | 983 << "CalcDrawProperties should not set_needs_update_draw_properties()"; |
| 976 return true; | 984 return true; |
| 977 } | 985 } |
| 978 | 986 |
| 979 void LayerTreeImpl::BuildPropertyTreesForTesting() { | 987 void LayerTreeImpl::BuildLayerListAndPropertyTreesForTesting() { |
| 988 BuildLayerListForTesting(); |
| 980 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer_); | 989 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(root_layer_); |
| 981 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); | 990 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); |
| 982 PropertyTreeBuilder::BuildPropertyTrees( | 991 PropertyTreeBuilder::BuildPropertyTrees( |
| 983 root_layer_, PageScaleLayer(), InnerViewportScrollLayer(), | 992 root_layer_, PageScaleLayer(), InnerViewportScrollLayer(), |
| 984 OuterViewportScrollLayer(), OverscrollElasticityLayer(), | 993 OuterViewportScrollLayer(), OverscrollElasticityLayer(), |
| 985 elastic_overscroll()->Current(IsActiveTree()), | 994 elastic_overscroll()->Current(IsActiveTree()), |
| 986 current_page_scale_factor(), device_scale_factor(), | 995 current_page_scale_factor(), device_scale_factor(), |
| 987 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), | 996 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), |
| 988 &property_trees_); | 997 &property_trees_); |
| 989 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); | 998 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); |
| (...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2059 } | 2068 } |
| 2060 | 2069 |
| 2061 void LayerTreeImpl::ResetAllChangeTracking() { | 2070 void LayerTreeImpl::ResetAllChangeTracking() { |
| 2062 layers_that_should_push_properties_.clear(); | 2071 layers_that_should_push_properties_.clear(); |
| 2063 for (auto* layer : *this) | 2072 for (auto* layer : *this) |
| 2064 layer->ResetChangeTracking(); | 2073 layer->ResetChangeTracking(); |
| 2065 property_trees_.ResetAllChangeTracking(); | 2074 property_trees_.ResetAllChangeTracking(); |
| 2066 } | 2075 } |
| 2067 | 2076 |
| 2068 } // namespace cc | 2077 } // namespace cc |
| OLD | NEW |