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

Unified Diff: cc/test/fake_layer_tree_host_impl.cc

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/fake_layer_tree_host_impl.h ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_layer_tree_host_impl.cc
diff --git a/cc/test/fake_layer_tree_host_impl.cc b/cc/test/fake_layer_tree_host_impl.cc
index 7361794e7b1aa707018c8fe3a0f6214f5863ada6..3dcd99f4c5c58957571553c435282f00a8e14170 100644
--- a/cc/test/fake_layer_tree_host_impl.cc
+++ b/cc/test/fake_layer_tree_host_impl.cc
@@ -54,4 +54,26 @@ void FakeLayerTreeHostImpl::SetCurrentFrameTimeTicks(
current_frame_time_ticks_ = current_frame_time_ticks;
}
+int FakeLayerTreeHostImpl::RecursiveUpdateNumChildren(LayerImpl* layer) {
+ int num_children_that_draw_content = 0;
+ for (size_t i = 0; i < layer->children().size(); ++i) {
+ num_children_that_draw_content +=
+ RecursiveUpdateNumChildren(layer->children()[i]);
+ }
+ if (layer->DrawsContent() && layer->HasDelegatedContent())
+ num_children_that_draw_content += 1000;
+ layer->SetNumDescendantsThatDrawContent(num_children_that_draw_content);
+ return num_children_that_draw_content + (layer->DrawsContent() ? 1 : 0);
+}
+
+void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawPropertiesForActiveTree() {
+ UpdateNumChildrenAndDrawProperties(active_tree());
+}
+
+void FakeLayerTreeHostImpl::UpdateNumChildrenAndDrawProperties(
+ LayerTreeImpl* layerTree) {
+ RecursiveUpdateNumChildren(layerTree->root_layer());
+ layerTree->UpdateDrawProperties();
+}
+
} // namespace cc
« no previous file with comments | « cc/test/fake_layer_tree_host_impl.h ('k') | cc/trees/damage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698