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

Side by Side Diff: cc/trees/layer_tree_impl.cc

Issue 2106273002: cc: Change how/when we build layer list/property tress in tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: propertytreestuff: . Created 4 years, 5 months 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
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 } 258 }
259 259
260 bool LayerTreeImpl::LayerListIsEmpty() const { 260 bool LayerTreeImpl::LayerListIsEmpty() const {
261 return layer_list_.empty(); 261 return layer_list_.empty();
262 } 262 }
263 263
264 void LayerTreeImpl::SetRootLayerForTesting(std::unique_ptr<LayerImpl> layer) { 264 void LayerTreeImpl::SetRootLayerForTesting(std::unique_ptr<LayerImpl> layer) {
265 if (root_layer_for_testing_ && layer.get() != root_layer_for_testing_) 265 if (root_layer_for_testing_ && layer.get() != root_layer_for_testing_)
266 RemoveLayer(root_layer_for_testing_->id()); 266 RemoveLayer(root_layer_for_testing_->id());
267 root_layer_for_testing_ = layer.get(); 267 root_layer_for_testing_ = layer.get();
268 if (layer) 268 ClearLayerList();
269 if (layer) {
269 AddLayer(std::move(layer)); 270 AddLayer(std::move(layer));
270 BuildLayerListForTesting(); 271 BuildLayerListForTesting();
272 }
271 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); 273 layer_tree_host_impl_->OnCanDrawStateChangedForTree();
272 } 274 }
273 275
274 void LayerTreeImpl::SetRootLayerFromLayerListForTesting() { 276 void LayerTreeImpl::SetRootLayerFromLayerListForTesting() {
275 root_layer_for_testing_ = layer_list_.empty() ? nullptr : layer_list_[0]; 277 root_layer_for_testing_ = layer_list_.empty() ? nullptr : layer_list_[0];
276 } 278 }
277 279
278 void LayerTreeImpl::OnCanDrawStateChangedForTree() { 280 void LayerTreeImpl::OnCanDrawStateChangedForTree() {
279 layer_tree_host_impl_->OnCanDrawStateChangedForTree(); 281 layer_tree_host_impl_->OnCanDrawStateChangedForTree();
280 } 282 }
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 "layers_updated_count", layers_updated_count); 1017 "layers_updated_count", layers_updated_count);
1016 } 1018 }
1017 1019
1018 DCHECK(!needs_update_draw_properties_) 1020 DCHECK(!needs_update_draw_properties_)
1019 << "CalcDrawProperties should not set_needs_update_draw_properties()"; 1021 << "CalcDrawProperties should not set_needs_update_draw_properties()";
1020 return true; 1022 return true;
1021 } 1023 }
1022 1024
1023 void LayerTreeImpl::BuildLayerListAndPropertyTreesForTesting() { 1025 void LayerTreeImpl::BuildLayerListAndPropertyTreesForTesting() {
1024 BuildLayerListForTesting(); 1026 BuildLayerListForTesting();
1025 PropertyTreeBuilder::PreCalculateMetaInformationForTesting( 1027 BuildPropertyTreesForTesting();
1026 root_layer_for_testing_); 1028 }
1029
1030 void LayerTreeImpl::BuildPropertyTreesForTesting() {
1031 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(layer_list_[0]);
1032 property_trees_.needs_rebuild = true;
1027 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); 1033 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true);
1028 PropertyTreeBuilder::BuildPropertyTrees( 1034 PropertyTreeBuilder::BuildPropertyTrees(
1029 root_layer_for_testing_, PageScaleLayer(), InnerViewportScrollLayer(), 1035 layer_list_[0], PageScaleLayer(), InnerViewportScrollLayer(),
1030 OuterViewportScrollLayer(), OverscrollElasticityLayer(), 1036 OuterViewportScrollLayer(), OverscrollElasticityLayer(),
1031 elastic_overscroll()->Current(IsActiveTree()), 1037 elastic_overscroll()->Current(IsActiveTree()),
1032 current_page_scale_factor(), device_scale_factor(), 1038 current_page_scale_factor(), device_scale_factor(),
1033 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), 1039 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(),
1034 &property_trees_); 1040 &property_trees_);
1035 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); 1041 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false);
1036 } 1042 }
1037 1043
1038 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { 1044 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const {
1039 // If this assert triggers, then the list is dirty. 1045 // If this assert triggers, then the list is dirty.
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 2097
2092 void LayerTreeImpl::ResetAllChangeTracking() { 2098 void LayerTreeImpl::ResetAllChangeTracking() {
2093 layers_that_should_push_properties_.clear(); 2099 layers_that_should_push_properties_.clear();
2094 // Iterate over all layers, including masks and replicas. 2100 // Iterate over all layers, including masks and replicas.
2095 for (auto& layer : *layers_) 2101 for (auto& layer : *layers_)
2096 layer->ResetChangeTracking(); 2102 layer->ResetChangeTracking();
2097 property_trees_.ResetAllChangeTracking(); 2103 property_trees_.ResetAllChangeTracking();
2098 } 2104 }
2099 2105
2100 } // namespace cc 2106 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698