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)); |
} |