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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 1842883002: cc : Check copy request count using effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index 5a67472a2aa03480e0e5d447d6a8137bf14fa6d5..9d658b8b3e57a7471eacecea769a116710ae15fa 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -765,29 +765,30 @@ void LayerTreeImpl::ClearViewportLayers() {
}
#if DCHECK_IS_ON()
-int SanityCheckCopyRequestCounts(LayerImpl* layer) {
- int count = layer->HasCopyRequest() ? 1 : 0;
- for (size_t i = 0; i < layer->children().size(); ++i) {
- count += SanityCheckCopyRequestCounts(layer->child_at(i));
+void SanityCheckCopyRequestCounts(LayerTreeImpl* layer_tree_impl) {
+ EffectTree& effect_tree = layer_tree_impl->property_trees()->effect_tree;
+ const int effect_tree_size = static_cast<int>(effect_tree.size());
+ std::vector<int> copy_requests_count_in_effect_tree(effect_tree_size);
+ for (auto* layer : *layer_tree_impl) {
+ if (layer->HasCopyRequest()) {
+ copy_requests_count_in_effect_tree[layer->effect_tree_index()]++;
+ }
}
- if (layer->layer_tree_impl()
- ->property_trees()
- ->effect_tree.Node(layer->effect_tree_index())
- ->owner_id == layer->id()) {
- DCHECK_EQ(count, layer->num_copy_requests_in_target_subtree())
- << ", id: " << layer->id();
- } else {
- DCHECK_LE(count, layer->num_copy_requests_in_target_subtree())
- << ", id: " << layer->id();
+ for (int i = effect_tree_size - 1; i >= 0; i--) {
+ EffectNode* node = effect_tree.Node(i);
+ DCHECK_EQ(node->data.num_copy_requests_in_subtree,
+ copy_requests_count_in_effect_tree[i]);
+ if (node->parent_id >= 0)
+ copy_requests_count_in_effect_tree[node->parent_id] +=
+ copy_requests_count_in_effect_tree[i];
}
- return count;
}
#endif
bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
#if DCHECK_IS_ON()
if (root_layer())
- SanityCheckCopyRequestCounts(root_layer());
+ SanityCheckCopyRequestCounts(root_layer()->layer_tree_impl());
#endif
if (!needs_update_draw_properties_)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698