| 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) {
|
|
|