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

Unified Diff: cc/trees/tree_synchronizer.cc

Issue 2829853009: cc : Add DCHECKs to ensure we have valid proprety tree indices at commit (Closed)
Patch Set: Created 3 years, 8 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/layers/scrollbar_layer_unittest.cc ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/tree_synchronizer.cc
diff --git a/cc/trees/tree_synchronizer.cc b/cc/trees/tree_synchronizer.cc
index 52f1bb384c752137b6ca7f2bfc72139e4bc42ad1..d312d9d2515db04f9ad16897903a57498fe427ec 100644
--- a/cc/trees/tree_synchronizer.cc
+++ b/cc/trees/tree_synchronizer.cc
@@ -74,6 +74,17 @@ std::unique_ptr<LayerImpl> ReuseOrCreateLayerImpl(OwnedLayerImplMap* old_layers,
return layer_impl;
}
+#if DCHECK_IS_ON()
+template <typename LayerType>
+static bool LayerHasValidPropertyTreeIndices(LayerType* layer) {
+ DCHECK(layer);
+ return layer->transform_tree_index() != TransformTree::kInvalidNodeId &&
enne (OOO) 2017/04/21 22:57:28 One thing you might consider is to just make this
jaydasika 2017/04/25 21:02:38 Added AssertValidPropertyTreeIndices (we still nee
+ layer->effect_tree_index() != EffectTree::kInvalidNodeId &&
+ layer->clip_tree_index() != ClipTree::kInvalidNodeId &&
+ layer->scroll_tree_index() != ScrollTree::kInvalidNodeId;
+}
+#endif
+
template <typename LayerTreeType>
void PushLayerList(OwnedLayerImplMap* old_layers,
LayerTreeType* host,
@@ -83,6 +94,12 @@ void PushLayerList(OwnedLayerImplMap* old_layers,
std::unique_ptr<LayerImpl> layer_impl(
ReuseOrCreateLayerImpl(old_layers, layer, tree_impl));
+ // Every layer should have valid property tree indices
+ DCHECK(LayerHasValidPropertyTreeIndices(layer));
+ // Every layer_impl should either have valid property tree indices already
+ // or the corresponding layer should push them onto layer_impl.
+ DCHECK(LayerHasValidPropertyTreeIndices(layer_impl.get()) ||
+ host->LayerNeedsPushPropertiesForTesting(layer));
tree_impl->AddToLayerList(layer_impl.get());
tree_impl->AddLayer(std::move(layer_impl));
}
« no previous file with comments | « cc/layers/scrollbar_layer_unittest.cc ('k') | cc/trees/tree_synchronizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698