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

Unified Diff: cc/layers/layer_impl.cc

Issue 1447893002: compositor-worker: Introduce WebCompositorMutableState (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index aa2a2b578621b197ef8bfb5745e430fad448aa9a..228e19227a5564ead2d3ad113043e0de4c7c48a3 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -106,6 +106,10 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
layer_animation_controller_->set_layer_animation_delegate(this);
}
}
+
+ if (element_id_)
+ layer_tree_impl_->AddToElementMap(this);
+
SetNeedsPushProperties();
}
@@ -123,6 +127,9 @@ LayerImpl::~LayerImpl() {
layer_tree_impl_->UnregisterScrollLayer(this);
layer_tree_impl_->UnregisterLayer(this);
+ if (element_id_)
+ layer_tree_impl_->RemoveFromElementMap(this);
+
TRACE_EVENT_OBJECT_DELETED_WITH_ID(
TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
}
@@ -1219,7 +1226,11 @@ void LayerImpl::SetElementId(uint64_t element_id) {
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
"LayerImpl::SetElementId", "id", element_id);
+ if (element_id_)
+ layer_tree_impl_->RemoveFromElementMap(this);
element_id_ = element_id;
+ if (element_id_)
+ layer_tree_impl_->AddToElementMap(this);
SetNeedsPushProperties();
}
@@ -1231,6 +1242,10 @@ void LayerImpl::SetMutableProperties(uint32_t properties) {
"LayerImpl::SetMutableProperties", "properties", properties);
mutable_properties_ = properties;
+ // If this layer is already in the element map, we will add it again in order
+ // to update the layer assignments per these new properties.
+ if (element_id_)
+ layer_tree_impl_->AddToElementMap(this);
SetNeedsPushProperties();
}

Powered by Google App Engine
This is Rietveld 408576698