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

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..d4504eb03c8d02cca54ccff52ab057b149c2ba15 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -765,22 +765,24 @@ 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(LayerImpl* root_layer) {
ajuma 2016/03/29 19:30:43 This is only using the root_layer in order to get
jaydasika 2016/03/29 19:35:15 Done.
+ EffectTree& effect_tree =
+ root_layer->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 : *root_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
« 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