OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/layers/layer.h" | 5 #include "cc/layers/layer.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (layer_tree_host_ == host) | 128 if (layer_tree_host_ == host) |
129 return; | 129 return; |
130 | 130 |
131 if (layer_tree_host_) { | 131 if (layer_tree_host_) { |
132 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id()); | 132 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id()); |
133 layer_tree_host_->property_trees()->needs_rebuild = true; | 133 layer_tree_host_->property_trees()->needs_rebuild = true; |
134 layer_tree_->UnregisterLayer(this); | 134 layer_tree_->UnregisterLayer(this); |
135 if (inputs_.element_id) { | 135 if (inputs_.element_id) { |
136 layer_tree_host_->animation_host()->UnregisterElement( | 136 layer_tree_host_->animation_host()->UnregisterElement( |
137 inputs_.element_id, ElementListType::ACTIVE); | 137 inputs_.element_id, ElementListType::ACTIVE); |
138 layer_tree_host_->RemoveFromElementMap(this); | 138 layer_tree_->RemoveFromElementMap(this); |
139 } | 139 } |
140 } | 140 } |
141 if (host) { | 141 if (host) { |
142 host->property_trees()->needs_rebuild = true; | 142 host->property_trees()->needs_rebuild = true; |
143 host->GetLayerTree()->RegisterLayer(this); | 143 host->GetLayerTree()->RegisterLayer(this); |
144 if (inputs_.element_id) { | 144 if (inputs_.element_id) { |
145 host->AddToElementMap(this); | 145 host->GetLayerTree()->AddToElementMap(this); |
146 host->animation_host()->RegisterElement(inputs_.element_id, | 146 host->animation_host()->RegisterElement(inputs_.element_id, |
147 ElementListType::ACTIVE); | 147 ElementListType::ACTIVE); |
148 } | 148 } |
149 } | 149 } |
150 | 150 |
151 layer_tree_host_ = host; | 151 layer_tree_host_ = host; |
152 layer_tree_ = host ? host->GetLayerTree() : nullptr; | 152 layer_tree_ = host ? host->GetLayerTree() : nullptr; |
153 InvalidatePropertyTreesIndices(); | 153 InvalidatePropertyTreesIndices(); |
154 | 154 |
155 // When changing hosts, the layer needs to commit its properties to the impl | 155 // When changing hosts, the layer needs to commit its properties to the impl |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 | 1841 |
1842 void Layer::SetElementId(ElementId id) { | 1842 void Layer::SetElementId(ElementId id) { |
1843 DCHECK(IsPropertyChangeAllowed()); | 1843 DCHECK(IsPropertyChangeAllowed()); |
1844 if (inputs_.element_id == id) | 1844 if (inputs_.element_id == id) |
1845 return; | 1845 return; |
1846 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 1846 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
1847 "Layer::SetElementId", "element", id.AsValue().release()); | 1847 "Layer::SetElementId", "element", id.AsValue().release()); |
1848 if (inputs_.element_id && layer_tree_host()) { | 1848 if (inputs_.element_id && layer_tree_host()) { |
1849 layer_tree_host()->animation_host()->UnregisterElement( | 1849 layer_tree_host()->animation_host()->UnregisterElement( |
1850 inputs_.element_id, ElementListType::ACTIVE); | 1850 inputs_.element_id, ElementListType::ACTIVE); |
1851 layer_tree_host()->RemoveFromElementMap(this); | 1851 layer_tree_->RemoveFromElementMap(this); |
1852 } | 1852 } |
1853 | 1853 |
1854 inputs_.element_id = id; | 1854 inputs_.element_id = id; |
1855 | 1855 |
1856 if (inputs_.element_id && layer_tree_host()) { | 1856 if (inputs_.element_id && layer_tree_host()) { |
1857 layer_tree_host()->animation_host()->RegisterElement( | 1857 layer_tree_host()->animation_host()->RegisterElement( |
1858 inputs_.element_id, ElementListType::ACTIVE); | 1858 inputs_.element_id, ElementListType::ACTIVE); |
1859 layer_tree_host()->AddToElementMap(this); | 1859 layer_tree_->AddToElementMap(this); |
1860 } | 1860 } |
1861 | 1861 |
1862 SetNeedsCommit(); | 1862 SetNeedsCommit(); |
1863 } | 1863 } |
1864 | 1864 |
1865 void Layer::SetMutableProperties(uint32_t properties) { | 1865 void Layer::SetMutableProperties(uint32_t properties) { |
1866 DCHECK(IsPropertyChangeAllowed()); | 1866 DCHECK(IsPropertyChangeAllowed()); |
1867 if (inputs_.mutable_properties == properties) | 1867 if (inputs_.mutable_properties == properties) |
1868 return; | 1868 return; |
1869 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 1869 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
(...skipping 21 matching lines...) Expand all Loading... |
1891 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); | 1891 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); |
1892 return draw_property_utils::ScreenSpaceTransform( | 1892 return draw_property_utils::ScreenSpaceTransform( |
1893 this, layer_tree_host_->property_trees()->transform_tree); | 1893 this, layer_tree_host_->property_trees()->transform_tree); |
1894 } | 1894 } |
1895 | 1895 |
1896 LayerTree* Layer::GetLayerTree() const { | 1896 LayerTree* Layer::GetLayerTree() const { |
1897 return layer_tree_; | 1897 return layer_tree_; |
1898 } | 1898 } |
1899 | 1899 |
1900 } // namespace cc | 1900 } // namespace cc |
OLD | NEW |