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

Unified Diff: cc/layers/layer_impl.cc

Issue 2048863003: Reland 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 407449d774176c40a69ec524808bbb5d3ea21e35..ed6218de99cdf095edb19e5cbd1a1767c9513e73 100644
--- a/cc/layers/layer_impl.cc
+++ b/cc/layers/layer_impl.cc
@@ -104,11 +104,12 @@
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_)
- layer_tree_impl_->RemoveLayer(mask_layer_id_);
+ DCHECK(!layer_tree_impl_->RemoveLayer(mask_layer_id_));
if (replica_layer_)
- layer_tree_impl_->RemoveLayer(replica_layer_id_);
- ClearChildList();
+ DCHECK(!layer_tree_impl_->RemoveLayer(replica_layer_id_));
+ children_.clear();
}
void LayerImpl::AddChild(std::unique_ptr<LayerImpl> child) {
@@ -128,14 +129,6 @@
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() {
@@ -848,11 +841,14 @@
replica_layer_id_ = new_layer_id;
}
-std::unique_ptr<LayerImpl> LayerImpl::TakeReplicaLayer() {
+std::unique_ptr<LayerImpl> LayerImpl::TakeReplicaLayerForTesting() {
replica_layer_id_ = -1;
std::unique_ptr<LayerImpl> ret;
- if (replica_layer_)
+ if (replica_layer_) {
+ if (replica_layer_->mask_layer())
+ replica_layer_->SetMaskLayer(nullptr);
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