Index: cc/trees/tree_synchronizer.cc |
diff --git a/cc/trees/tree_synchronizer.cc b/cc/trees/tree_synchronizer.cc |
index 87efee06cab3859b3382d1fbd7e7c8d6e07037b5..fa71e4e85087150b3f0f1243ee6bd56103199daf 100644 |
--- a/cc/trees/tree_synchronizer.cc |
+++ b/cc/trees/tree_synchronizer.cc |
@@ -93,26 +93,44 @@ static bool LayerHasValidPropertyTreeIndices(LayerImpl* layer) { |
} |
#endif |
+static bool IsHidden(Layer* layer) { |
+ return layer->is_hidden(); |
+} |
+ |
+static bool IsHidden(LayerImpl* layer) { |
+ return false; |
+} |
+ |
+static void RemoveLayerShouldPushProperties(LayerTreeHost* host, Layer* layer) { |
+ host->RemoveLayerShouldPushProperties(layer); |
+} |
+ |
+static void RemoveLayerShouldPushProperties(LayerTreeImpl* host_impl, |
+ LayerImpl* layer) {} |
+ |
template <typename LayerTreeType> |
void PushLayerList(OwnedLayerImplMap* old_layers, |
LayerTreeType* host, |
LayerTreeImpl* tree_impl) { |
tree_impl->ClearLayerList(); |
for (auto* layer : *host) { |
- std::unique_ptr<LayerImpl> layer_impl( |
- ReuseOrCreateLayerImpl(old_layers, layer, tree_impl)); |
+ if (!IsHidden(layer)) { |
+ std::unique_ptr<LayerImpl> layer_impl( |
+ ReuseOrCreateLayerImpl(old_layers, layer, tree_impl)); |
#if DCHECK_IS_ON() |
- // Every layer should have valid property tree indices |
- AssertValidPropertyTreeIndices(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)); |
+ // Every layer should have valid property tree indices |
+ AssertValidPropertyTreeIndices(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)); |
#endif |
- |
- tree_impl->AddToLayerList(layer_impl.get()); |
- tree_impl->AddLayer(std::move(layer_impl)); |
+ tree_impl->AddToLayerList(layer_impl.get()); |
+ tree_impl->AddLayer(std::move(layer_impl)); |
+ } else { |
+ RemoveLayerShouldPushProperties(host, layer); |
+ } |
} |
tree_impl->OnCanDrawStateChangedForTree(); |
} |