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

Unified Diff: cc/layers/layer.cc

Issue 572483002: Fix RemoveFromScrollTree and RemoveFromClipTree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 3 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.h ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 63b9990d65faf0e9cb34cac442e7a2c03c44e08a..1a22d9254a9b5bded9b1560c4769760efa57779d 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -91,6 +91,9 @@ Layer::~Layer() {
layer_animation_controller_->RemoveValueObserver(this);
layer_animation_controller_->remove_value_provider(this);
+ RemoveFromScrollTree();
+ RemoveFromClipTree();
+
// Remove the parent reference from all children and dependents.
RemoveAllChildren();
if (mask_layer_.get()) {
@@ -101,9 +104,6 @@ Layer::~Layer() {
DCHECK_EQ(this, replica_layer_->parent());
replica_layer_->RemoveFromParent();
}
-
- RemoveFromScrollTree();
- RemoveFromClipTree();
}
void Layer::SetLayerTreeHost(LayerTreeHost* host) {
@@ -1200,28 +1200,24 @@ bool Layer::SupportsLCDText() const {
void Layer::RemoveFromScrollTree() {
if (scroll_children_.get()) {
- for (std::set<Layer*>::iterator it = scroll_children_->begin();
- it != scroll_children_->end(); ++it)
- (*it)->scroll_parent_ = NULL;
+ std::set<Layer*> copy = *scroll_children_;
+ for (std::set<Layer*>::iterator it = copy.begin(); it != copy.end(); ++it)
+ (*it)->SetScrollParent(NULL);
}
- if (scroll_parent_)
- scroll_parent_->RemoveScrollChild(this);
-
- scroll_parent_ = NULL;
+ DCHECK(!scroll_children_);
+ SetScrollParent(NULL);
}
void Layer::RemoveFromClipTree() {
if (clip_children_.get()) {
- for (std::set<Layer*>::iterator it = clip_children_->begin();
- it != clip_children_->end(); ++it)
- (*it)->clip_parent_ = NULL;
+ std::set<Layer*> copy = *clip_children_;
+ for (std::set<Layer*>::iterator it = copy.begin(); it != copy.end(); ++it)
+ (*it)->SetClipParent(NULL);
}
- if (clip_parent_)
- clip_parent_->RemoveClipChild(this);
-
- clip_parent_ = NULL;
+ DCHECK(!clip_children_);
+ SetClipParent(NULL);
}
void Layer::AddDrawableDescendants(int num) {
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698