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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 2962563002: cc: Add CHECKs for diagnosing invalid property tree indices post-commit. (Closed)
Patch Set: Created 3 years, 6 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_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 390e14e743f1d89b9e7e2c2de3ecd87c26cc9564..7e1e56ae8138f373dcaf033a58e47cb6d450cde5 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -63,6 +63,29 @@ static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number;
}
namespace cc {
+namespace {
+
+void EnsureValidIndicesOnLayer(Layer* layer, PropertyTrees* property_trees) {
+ CHECK_EQ(property_trees->sequence_number,
+ layer->property_tree_sequence_number());
+ CHECK(property_trees->transform_tree.Node(layer->transform_tree_index()));
+ CHECK(property_trees->clip_tree.Node(layer->clip_tree_index()));
+ CHECK(property_trees->effect_tree.Node(layer->effect_tree_index()));
+ CHECK(property_trees->scroll_tree.Node(layer->scroll_tree_index()));
+}
+
+void EnsureValidPropertyTreeState(LayerTreeHost* host) {
+ // Temporary check to debug crbug.com/726423. The property tree indices on
+ // the LayerTreeImpl should be valid after all state synchronization has
+ // finished.
+ for (auto* layer : *host)
+ EnsureValidIndicesOnLayer(layer, host->property_trees());
+
+ for (auto id : host->property_trees()->effect_tree.mask_layer_ids())
+ EnsureValidIndicesOnLayer(host->LayerById(id), host->property_trees());
+}
+
+} // namespace
LayerTreeHost::InitParams::InitParams() {}
@@ -304,6 +327,8 @@ void LayerTreeHost::FinishCommitOnImplThread(
sync_tree->set_source_frame_number(SourceFrameNumber());
+ EnsureValidPropertyTreeState(this);
+
if (needs_full_tree_sync_)
TreeSynchronizer::SynchronizeTrees(root_layer(), sync_tree);
@@ -745,21 +770,13 @@ bool LayerTreeHost::DoUpdateLayers(Layer* root_layer) {
property_trees->AsTracedValue());
}
- // Temporary check to debug crbug.com/726423. The property tree indices on
- // the LayerTreeImpl should be valid after all state synchronization has
- // finished.
- for (auto* layer : *this) {
- CHECK(property_trees_.transform_tree.Node(layer->transform_tree_index()));
- CHECK(property_trees_.clip_tree.Node(layer->clip_tree_index()));
- CHECK(property_trees_.effect_tree.Node(layer->effect_tree_index()));
- CHECK(property_trees_.scroll_tree.Node(layer->scroll_tree_index()));
- }
-
draw_property_utils::UpdatePropertyTrees(this, property_trees);
draw_property_utils::FindLayersThatNeedUpdates(this, property_trees,
&update_layer_list);
}
+ EnsureValidPropertyTreeState(this);
+
bool content_is_suitable_for_gpu = true;
bool did_paint_content =
PaintContent(update_layer_list, &content_is_suitable_for_gpu);
« 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