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

Unified Diff: cc/layers/layer_impl.cc

Issue 2054483002: Revert of cc : Make LayerImpl destruction independent of tree hierarchy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/picture_layer_impl_perftest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer_impl.cc
diff --git a/cc/layers/layer_impl.cc b/cc/layers/layer_impl.cc
index ed6218de99cdf095edb19e5cbd1a1767c9513e73..407449d774176c40a69ec524808bbb5d3ea21e35 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -104,12 +104,11 @@
TRACE_EVENT_OBJECT_DELETED_WITH_ID(
TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerImpl", this);
- // The mask and replica layers should have been removed already.
if (mask_layer_)
- DCHECK(!layer_tree_impl_->RemoveLayer(mask_layer_id_));
+ layer_tree_impl_->RemoveLayer(mask_layer_id_);
if (replica_layer_)
- DCHECK(!layer_tree_impl_->RemoveLayer(replica_layer_id_));
- children_.clear();
+ layer_tree_impl_->RemoveLayer(replica_layer_id_);
+ ClearChildList();
}
void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) {
@@ -129,6 +128,14 @@
void LayerImpl::SetParent(LayerImpl* parent) {
parent_ = parent;
+}
+
+void LayerImpl::ClearChildList() {
+ if (children_.empty())
+ return;
+ for (auto* child : children_)
+ layer_tree_impl_->RemoveLayer(child->id());
+ children_.clear();
}
void LayerImpl::ClearLinksToOtherLayers() {
@@ -841,14 +848,11 @@
replica_layer_id_ = new_layer_id;
}
-std::unique_ptr<LayerImpl> LayerImpl::TakeReplicaLayerForTesting() {
+std::unique_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() {
replica_layer_id_ = -1;
std::unique_ptr<LayerImpl> ret;
- if (replica_layer_) {
- if (replica_layer_->mask_layer())
- replica_layer_->SetMaskLayer(nullptr);
+ if (replica_layer_)
ret = layer_tree_impl_->RemoveLayer(replica_layer_->id());
- }
replica_layer_ = nullptr;
return ret;
}
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/picture_layer_impl_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698