Chromium Code Reviews| Index: cc/layers/layer.cc |
| diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
| index 6f9239a1940986f39d024f5003f8ac7a8afc1f4d..d98ea3dbc47c9417a876ac0f99f29f8ff22a9283 100644 |
| --- a/cc/layers/layer.cc |
| +++ b/cc/layers/layer.cc |
| @@ -133,18 +133,18 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
| layer_tree_host_->property_trees()->needs_rebuild = true; |
| layer_tree_->UnregisterLayer(this); |
| if (inputs_.element_id) { |
| - layer_tree_host_->animation_host()->UnregisterElement( |
| - inputs_.element_id, ElementListType::ACTIVE); |
| - layer_tree_host_->RemoveFromElementMap(this); |
| + layer_tree_->animation_host()->UnregisterElement(inputs_.element_id, |
|
Khushal
2016/08/15 17:46:39
May be you can just add a RegisterElement method t
xingliu
2016/08/15 21:29:12
Done.
|
| + ElementListType::ACTIVE); |
| + layer_tree_->RemoveFromElementMap(this); |
| } |
| } |
| if (host) { |
| host->property_trees()->needs_rebuild = true; |
| host->GetLayerTree()->RegisterLayer(this); |
| if (inputs_.element_id) { |
| - host->AddToElementMap(this); |
| - host->animation_host()->RegisterElement(inputs_.element_id, |
| - ElementListType::ACTIVE); |
| + host->GetLayerTree()->AddToElementMap(this); |
| + host->GetLayerTree()->animation_host()->RegisterElement( |
| + inputs_.element_id, ElementListType::ACTIVE); |
| } |
| } |
| @@ -852,7 +852,8 @@ void Layer::SetScrollClipLayerId(int clip_layer_id) { |
| } |
| Layer* Layer::scroll_clip_layer() const { |
| - return layer_tree_host()->LayerById(inputs_.scroll_clip_layer_id); |
| + DCHECK(layer_tree_); |
| + return layer_tree_->LayerById(inputs_.scroll_clip_layer_id); |
| } |
| void Layer::SetUserScrollable(bool horizontal, bool vertical) { |
| @@ -1490,10 +1491,9 @@ void Layer::FromLayerSpecificPropertiesProto( |
| inputs_.user_scrollable_horizontal = base.user_scrollable_horizontal(); |
| inputs_.user_scrollable_vertical = base.user_scrollable_vertical(); |
| - inputs_.scroll_parent = |
| - base.scroll_parent_id() == INVALID_ID |
| - ? nullptr |
| - : layer_tree_host_->LayerById(base.scroll_parent_id()); |
| + inputs_.scroll_parent = base.scroll_parent_id() == INVALID_ID |
| + ? nullptr |
| + : layer_tree_->LayerById(base.scroll_parent_id()); |
| // If there have been scroll children entries in previous deserializations, |
| // clear out the set. If there have been none, initialize the set of children. |
| @@ -1506,14 +1506,13 @@ void Layer::FromLayerSpecificPropertiesProto( |
| scroll_children_.reset(new std::set<Layer*>); |
| for (int i = 0; i < base.scroll_children_ids_size(); ++i) { |
| int child_id = base.scroll_children_ids(i); |
| - scoped_refptr<Layer> child = layer_tree_host_->LayerById(child_id); |
| + scoped_refptr<Layer> child = layer_tree_->LayerById(child_id); |
| scroll_children_->insert(child.get()); |
| } |
| - inputs_.clip_parent = |
| - base.clip_parent_id() == INVALID_ID |
| - ? nullptr |
| - : layer_tree_host_->LayerById(base.clip_parent_id()); |
| + inputs_.clip_parent = base.clip_parent_id() == INVALID_ID |
| + ? nullptr |
| + : layer_tree_->LayerById(base.clip_parent_id()); |
| // If there have been clip children entries in previous deserializations, |
| // clear out the set. If there have been none, initialize the set of children. |
| @@ -1526,7 +1525,7 @@ void Layer::FromLayerSpecificPropertiesProto( |
| clip_children_.reset(new std::set<Layer*>); |
| for (int i = 0; i < base.clip_children_ids_size(); ++i) { |
| int child_id = base.clip_children_ids(i); |
| - scoped_refptr<Layer> child = layer_tree_host_->LayerById(child_id); |
| + scoped_refptr<Layer> child = layer_tree_->LayerById(child_id); |
| clip_children_->insert(child.get()); |
| } |
| @@ -1846,17 +1845,17 @@ void Layer::SetElementId(ElementId id) { |
| TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| "Layer::SetElementId", "element", id.AsValue().release()); |
| if (inputs_.element_id && layer_tree_host()) { |
| - layer_tree_host()->animation_host()->UnregisterElement( |
| - inputs_.element_id, ElementListType::ACTIVE); |
| - layer_tree_host()->RemoveFromElementMap(this); |
| + layer_tree_->animation_host()->UnregisterElement(inputs_.element_id, |
| + ElementListType::ACTIVE); |
| + layer_tree_->RemoveFromElementMap(this); |
| } |
| inputs_.element_id = id; |
| if (inputs_.element_id && layer_tree_host()) { |
| - layer_tree_host()->animation_host()->RegisterElement( |
| - inputs_.element_id, ElementListType::ACTIVE); |
| - layer_tree_host()->AddToElementMap(this); |
| + layer_tree_->animation_host()->RegisterElement(inputs_.element_id, |
| + ElementListType::ACTIVE); |
| + layer_tree_->AddToElementMap(this); |
| } |
| SetNeedsCommit(); |