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

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 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 6892f39c45344ece19c7b9daf3ebd44440a2362d..c5c22ee7af3ab188edfde16d8438f59cc773c90d 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -109,6 +109,10 @@ LayerImpl::LayerImpl(LayerTreeImpl* tree_impl,
layer_animation_controller_->set_layer_animation_delegate(this);
}
}
+
+ if (element_id_)
+ layer_tree_impl_->AddToElementMap(this);
+
SetNeedsPushProperties();
}
@@ -126,6 +130,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);
}
@@ -1235,7 +1242,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();
}
@@ -1247,6 +1258,9 @@ void LayerImpl::SetMutableProperties(uint32_t properties) {
"LayerImpl::SetMutableProperties", "properties", properties);
mutable_properties_ = properties;
+ // If this layer is already in the element map, update its properties.
+ if (element_id_)
+ layer_tree_impl_->AddToElementMap(this);
SetNeedsPushProperties();
}

Powered by Google App Engine
This is Rietveld 408576698