Chromium Code Reviews| Index: cc/layers/layer.cc |
| diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc |
| index e0e09b5d630c48532175ed6f7c0177344743c140..aafc73eb0830bfe8d8cb136b89962fb5e6180fa1 100644 |
| --- a/cc/layers/layer.cc |
| +++ b/cc/layers/layer.cc |
| @@ -129,7 +129,7 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
| if (layer_tree_host_) { |
| layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id()); |
| layer_tree_host_->property_trees()->needs_rebuild = true; |
| - layer_tree_host_->UnregisterLayer(this); |
| + GetLayerTree()->UnregisterLayer(this); |
| if (inputs_.element_id) { |
| layer_tree_host_->animation_host()->UnregisterElement( |
| inputs_.element_id, ElementListType::ACTIVE); |
| @@ -138,7 +138,7 @@ void Layer::SetLayerTreeHost(LayerTreeHost* host) { |
| } |
| if (host) { |
| host->property_trees()->needs_rebuild = true; |
| - host->RegisterLayer(this); |
| + host->GetLayerTree()->RegisterLayer(this); |
| if (inputs_.element_id) { |
| host->AddToElementMap(this); |
| host->animation_host()->RegisterElement(inputs_.element_id, |
| @@ -215,18 +215,18 @@ void Layer::SetNextCommitWaitsForActivation() { |
| void Layer::SetNeedsPushProperties() { |
| if (layer_tree_host_) |
|
vmpstr
2016/07/27 18:05:30
if (GetLayerTree()) here and throughout
|
| - layer_tree_host_->AddLayerShouldPushProperties(this); |
| + GetLayerTree()->AddLayerShouldPushProperties(this); |
| } |
| void Layer::ResetNeedsPushPropertiesForTesting() { |
| - layer_tree_host_->RemoveLayerShouldPushProperties(this); |
| + GetLayerTree()->RemoveLayerShouldPushProperties(this); |
| } |
| bool Layer::IsPropertyChangeAllowed() const { |
| if (!layer_tree_host_) |
| return true; |
| - return !layer_tree_host_->in_paint_layer_contents(); |
| + return !GetLayerTree()->in_paint_layer_contents(); |
| } |
| sk_sp<SkPicture> Layer::GetPicture() const { |
| @@ -1195,7 +1195,7 @@ void Layer::PushPropertiesTo(LayerImpl* layer) { |
| layer_property_changed_ = false; |
| inputs_.update_rect = gfx::Rect(); |
| - layer_tree_host()->RemoveLayerShouldPushProperties(this); |
| + GetLayerTree()->RemoveLayerShouldPushProperties(this); |
| } |
| void Layer::TakeCopyRequests( |
| @@ -1247,7 +1247,7 @@ void Layer::ClearLayerTreePropertiesForDeserializationAndAddToMap( |
| (*layer_map)[inputs_.layer_id] = this; |
| if (layer_tree_host_) |
| - layer_tree_host_->UnregisterLayer(this); |
| + GetLayerTree()->UnregisterLayer(this); |
| layer_tree_host_ = nullptr; |
| parent_ = nullptr; |
| @@ -1285,7 +1285,7 @@ void Layer::FromLayerNodeProto(const proto::LayerNode& proto, |
| inputs_.layer_id = proto.id(); |
| layer_tree_host_ = layer_tree_host; |
| - layer_tree_host_->RegisterLayer(this); |
| + GetLayerTree()->RegisterLayer(this); |
| for (int i = 0; i < proto.children_size(); ++i) { |
| const proto::LayerNode& child_proto = proto.children(i); |
| @@ -1747,7 +1747,8 @@ void Layer::SetHasWillChangeTransformHint(bool has_will_change) { |
| } |
| AnimationHost* Layer::GetAnimationHost() const { |
| - return layer_tree_host_ ? layer_tree_host_->animation_host() : nullptr; |
| + LayerTree* layer_tree = GetLayerTree(); |
| + return layer_tree ? layer_tree->animation_host() : nullptr; |
| } |
| ElementListType Layer::GetElementTypeForAnimation() const { |
| @@ -1849,4 +1850,8 @@ gfx::Transform Layer::screen_space_transform() const { |
| this, layer_tree_host_->property_trees()->transform_tree); |
| } |
| +LayerTree* Layer::GetLayerTree() const { |
| + return layer_tree_host_ ? layer_tree_host_->GetLayerTree() : nullptr; |
|
vmpstr
2016/07/25 20:45:46
If we're mimicking impl side of things, then layer
xingliu
2016/07/25 23:40:25
@Khushal
Khushal probably can answer this questio
Khushal
2016/07/26 18:10:41
Not sure. Blink uses the WebCompositorSupportImpl
|
| +} |
| + |
| } // namespace cc |