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

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: 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 1015
1014 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles", 1016 TRACE_EVENT_END1("cc", "LayerTreeImpl::UpdateDrawProperties::UpdateTiles",
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() {
jaydasika 2016/06/29 22:40:45 This can now just be : BuildLayerListForTesting();
danakj 2016/06/29 22:42:18 Oh sure, ya :)
1024 BuildLayerListForTesting(); 1026 BuildLayerListForTesting();
1025 PropertyTreeBuilder::PreCalculateMetaInformationForTesting( 1027 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(
1026 root_layer_for_testing_); 1028 root_layer_for_testing_);
1029 property_trees_.needs_rebuild = true;
1027 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true); 1030 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true);
1028 PropertyTreeBuilder::BuildPropertyTrees( 1031 PropertyTreeBuilder::BuildPropertyTrees(
1029 root_layer_for_testing_, PageScaleLayer(), InnerViewportScrollLayer(), 1032 root_layer_for_testing_, PageScaleLayer(), InnerViewportScrollLayer(),
1030 OuterViewportScrollLayer(), OverscrollElasticityLayer(), 1033 OuterViewportScrollLayer(), OverscrollElasticityLayer(),
1031 elastic_overscroll()->Current(IsActiveTree()), 1034 elastic_overscroll()->Current(IsActiveTree()),
1032 current_page_scale_factor(), device_scale_factor(), 1035 current_page_scale_factor(), device_scale_factor(),
1033 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(), 1036 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(),
1034 &property_trees_); 1037 &property_trees_);
1035 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false); 1038 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false);
1036 } 1039 }
1037 1040
1041 void LayerTreeImpl::BuildPropertyTreesForTesting() {
1042 PropertyTreeBuilder::PreCalculateMetaInformationForTesting(layer_list_[0]);
1043 property_trees_.needs_rebuild = true;
1044 property_trees_.transform_tree.set_source_to_parent_updates_allowed(true);
1045 PropertyTreeBuilder::BuildPropertyTrees(
1046 layer_list_[0], PageScaleLayer(), InnerViewportScrollLayer(),
1047 OuterViewportScrollLayer(), OverscrollElasticityLayer(),
1048 elastic_overscroll()->Current(IsActiveTree()),
1049 current_page_scale_factor(), device_scale_factor(),
1050 gfx::Rect(DrawViewportSize()), layer_tree_host_impl_->DrawTransform(),
1051 &property_trees_);
1052 property_trees_.transform_tree.set_source_to_parent_updates_allowed(false);
1053 }
1054
1038 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const { 1055 const LayerImplList& LayerTreeImpl::RenderSurfaceLayerList() const {
1039 // If this assert triggers, then the list is dirty. 1056 // If this assert triggers, then the list is dirty.
1040 DCHECK(!needs_update_draw_properties_); 1057 DCHECK(!needs_update_draw_properties_);
1041 return render_surface_layer_list_; 1058 return render_surface_layer_list_;
1042 } 1059 }
1043 1060
1044 const Region& LayerTreeImpl::UnoccludedScreenSpaceRegion() const { 1061 const Region& LayerTreeImpl::UnoccludedScreenSpaceRegion() const {
1045 // If this assert triggers, then the render_surface_layer_list_ is dirty, so 1062 // If this assert triggers, then the render_surface_layer_list_ is dirty, so
1046 // the unoccluded_screen_space_region_ is not valid anymore. 1063 // the unoccluded_screen_space_region_ is not valid anymore.
1047 DCHECK(!needs_update_draw_properties_); 1064 DCHECK(!needs_update_draw_properties_);
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after
2091 2108
2092 void LayerTreeImpl::ResetAllChangeTracking() { 2109 void LayerTreeImpl::ResetAllChangeTracking() {
2093 layers_that_should_push_properties_.clear(); 2110 layers_that_should_push_properties_.clear();
2094 // Iterate over all layers, including masks and replicas. 2111 // Iterate over all layers, including masks and replicas.
2095 for (auto& layer : *layers_) 2112 for (auto& layer : *layers_)
2096 layer->ResetChangeTracking(); 2113 layer->ResetChangeTracking();
2097 property_trees_.ResetAllChangeTracking(); 2114 property_trees_.ResetAllChangeTracking();
2098 } 2115 }
2099 2116
2100 } // namespace cc 2117 } // 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