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

Unified Diff: cc/trees/tree_synchronizer.cc

Issue 1808373002: cc : Make tree synchronization independent of layer tree hierarchy (2) (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
Index: cc/trees/tree_synchronizer.cc
diff --git a/cc/trees/tree_synchronizer.cc b/cc/trees/tree_synchronizer.cc
index af8705669c6c18a3fba566c8611d0578ed658f4e..f16de5f5959986083ecdec52b7938954c3c70982 100644
--- a/cc/trees/tree_synchronizer.cc
+++ b/cc/trees/tree_synchronizer.cc
@@ -129,119 +129,4 @@ scoped_ptr<LayerImpl> SynchronizeTreesRecursive(
new_layers, old_layers, layer, tree_impl);
}
-void TreeSynchronizer::PushPropertiesInternal(
- Layer* layer,
- LayerImpl* layer_impl,
- int* num_dependents_need_push_properties_for_parent) {
- if (!layer) {
- DCHECK(!layer_impl);
- return;
- }
-
- DCHECK_EQ(layer->id(), layer_impl->id());
-
- bool push_layer = layer->needs_push_properties();
- bool recurse_on_children_and_dependents =
- layer->descendant_needs_push_properties();
-
- if (push_layer)
- layer->PushPropertiesTo(layer_impl);
-
- int num_dependents_need_push_properties = 0;
- if (recurse_on_children_and_dependents) {
- PushPropertiesInternal(layer->mask_layer(),
- layer_impl->mask_layer(),
- &num_dependents_need_push_properties);
- PushPropertiesInternal(layer->replica_layer(),
- layer_impl->replica_layer(),
- &num_dependents_need_push_properties);
-
- const OwnedLayerImplList& impl_children = layer_impl->children();
- DCHECK_EQ(layer->children().size(), impl_children.size());
-
- for (size_t i = 0; i < layer->children().size(); ++i) {
- PushPropertiesInternal(layer->child_at(i), impl_children[i].get(),
- &num_dependents_need_push_properties);
- }
-
- // When PushPropertiesTo completes for a layer, it may still keep
- // its needs_push_properties() state if the layer must push itself
- // every PushProperties tree walk. Here we keep track of those layers, and
- // ensure that their ancestors know about them for the next PushProperties
- // tree walk.
- layer->num_dependents_need_push_properties_ =
- num_dependents_need_push_properties;
- }
-
- bool add_self_to_parent = num_dependents_need_push_properties > 0 ||
- layer->needs_push_properties();
- *num_dependents_need_push_properties_for_parent += add_self_to_parent ? 1 : 0;
-}
-
-static void CheckScrollAndClipPointersRecursive(Layer* layer,
ajuma 2016/03/18 14:33:16 This checks are pretty useful. It'd be nice to kee
jaydasika 2016/03/19 02:17:58 Done.
- LayerImpl* layer_impl) {
- DCHECK_EQ(!!layer, !!layer_impl);
- if (!layer)
- return;
-
- // Having a scroll parent on the impl thread implies having one the main
- // thread, too. The main thread may have a scroll parent that is not in the
- // tree because it's been removed but not deleted. In this case, the layer
- // impl will have no scroll parent. Same argument applies for clip parents and
- // scroll/clip children.
- DCHECK(!layer_impl->scroll_parent() || !!layer->scroll_parent());
- DCHECK(!layer_impl->clip_parent() || !!layer->clip_parent());
- DCHECK(!layer_impl->scroll_children() || !!layer->scroll_children());
- DCHECK(!layer_impl->clip_children() || !!layer->clip_children());
-
- if (layer_impl->scroll_parent())
- DCHECK_EQ(layer->scroll_parent()->id(), layer_impl->scroll_parent()->id());
-
- if (layer_impl->clip_parent())
- DCHECK_EQ(layer->clip_parent()->id(), layer_impl->clip_parent()->id());
-
- if (layer_impl->scroll_children()) {
- for (std::set<Layer*>::iterator it = layer->scroll_children()->begin();
- it != layer->scroll_children()->end();
- ++it) {
- DCHECK_EQ((*it)->scroll_parent(), layer);
- }
- for (std::set<LayerImpl*>::iterator it =
- layer_impl->scroll_children()->begin();
- it != layer_impl->scroll_children()->end();
- ++it) {
- DCHECK_EQ((*it)->scroll_parent(), layer_impl);
- }
- }
-
- if (layer_impl->clip_children()) {
- for (std::set<Layer*>::iterator it = layer->clip_children()->begin();
- it != layer->clip_children()->end();
- ++it) {
- DCHECK_EQ((*it)->clip_parent(), layer);
- }
- for (std::set<LayerImpl*>::iterator it =
- layer_impl->clip_children()->begin();
- it != layer_impl->clip_children()->end();
- ++it) {
- DCHECK_EQ((*it)->clip_parent(), layer_impl);
- }
- }
-
- for (size_t i = 0u; i < layer->children().size(); ++i) {
- CheckScrollAndClipPointersRecursive(layer->child_at(i),
- layer_impl->child_at(i));
- }
-}
-
-void TreeSynchronizer::PushProperties(Layer* layer,
- LayerImpl* layer_impl) {
- int num_dependents_need_push_properties = 0;
- PushPropertiesInternal(
- layer, layer_impl, &num_dependents_need_push_properties);
-#if DCHECK_IS_ON()
- CheckScrollAndClipPointersRecursive(layer, layer_impl);
-#endif
-}
-
} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698