| Index: cc/layers/layer.cc
|
| diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
|
| index 57c055b7fea3576c25ab680009ad6efe46a4f9c6..9677536e8e8b18f4a3229cbe8cf0102e2e69487b 100644
|
| --- a/cc/layers/layer.cc
|
| +++ b/cc/layers/layer.cc
|
| @@ -90,6 +90,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()) {
|
| @@ -100,9 +103,6 @@ Layer::~Layer() {
|
| DCHECK_EQ(this, replica_layer_->parent());
|
| replica_layer_->RemoveFromParent();
|
| }
|
| -
|
| - RemoveFromScrollTree();
|
| - RemoveFromClipTree();
|
| }
|
|
|
| void Layer::SetLayerTreeHost(LayerTreeHost* host) {
|
| @@ -1199,28 +1199,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) {
|
|
|