Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_impl.h" | 5 #include "cc/layers/layer_impl.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 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 942 } | 942 } |
| 943 | 943 |
| 944 bool LayerImpl::OpacityIsAnimating() const { | 944 bool LayerImpl::OpacityIsAnimating() const { |
| 945 return layer_tree_impl_->IsAnimatingOpacityProperty(this); | 945 return layer_tree_impl_->IsAnimatingOpacityProperty(this); |
| 946 } | 946 } |
| 947 | 947 |
| 948 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { | 948 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { |
| 949 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this); | 949 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this); |
| 950 } | 950 } |
| 951 | 951 |
| 952 void LayerImpl::SetElementId(uint64_t element_id) { | 952 void LayerImpl::SetElementId(ElementId element_id) { |
| 953 if (element_id == element_id_) | 953 if (element_id == element_id_) |
| 954 return; | 954 return; |
| 955 | 955 |
| 956 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 956 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 957 "LayerImpl::SetElementId", "id", element_id); | 957 "LayerImpl::SetElementId", "element", |
| 958 element_id.AsValue().release()); | |
| 958 | 959 |
| 959 layer_tree_impl_->RemoveFromElementMap(this); | 960 layer_tree_impl_->RemoveFromElementMap(this); |
| 960 element_id_ = element_id; | 961 element_id_ = element_id; |
| 961 layer_tree_impl_->AddToElementMap(this); | 962 layer_tree_impl_->AddToElementMap(this); |
| 963 | |
| 964 PropertyTrees* property_trees = layer_tree_impl()->property_trees(); | |
| 965 if (property_trees->IsInIdToIndexMap(PropertyTrees::TreeType::SCROLL, id())) { | |
| 966 ScrollNode* node = property_trees->scroll_tree.Node( | |
| 967 property_trees->scroll_id_to_index_map[id()]); | |
| 968 node->data.element_id = element_id_; | |
| 969 } | |
|
ajuma
2016/06/01 23:53:42
The property trees pushed from the main thread wil
Ian Vollick
2016/06/02 19:03:11
You're right. The problem was that I'd called SetE
| |
| 970 | |
| 962 SetNeedsPushProperties(); | 971 SetNeedsPushProperties(); |
| 963 } | 972 } |
| 964 | 973 |
| 965 void LayerImpl::SetMutableProperties(uint32_t properties) { | 974 void LayerImpl::SetMutableProperties(uint32_t properties) { |
| 966 if (mutable_properties_ == properties) | 975 if (mutable_properties_ == properties) |
| 967 return; | 976 return; |
| 968 | 977 |
| 969 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), | 978 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), |
| 970 "LayerImpl::SetMutableProperties", "properties", properties); | 979 "LayerImpl::SetMutableProperties", "properties", properties); |
| 971 | 980 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1142 MathUtil::AddToTracedValue("bounds", bounds_, state); | 1151 MathUtil::AddToTracedValue("bounds", bounds_, state); |
| 1143 | 1152 |
| 1144 state->SetDouble("opacity", Opacity()); | 1153 state->SetDouble("opacity", Opacity()); |
| 1145 | 1154 |
| 1146 MathUtil::AddToTracedValue("position", position_, state); | 1155 MathUtil::AddToTracedValue("position", position_, state); |
| 1147 | 1156 |
| 1148 state->SetInteger("draws_content", DrawsContent()); | 1157 state->SetInteger("draws_content", DrawsContent()); |
| 1149 state->SetInteger("gpu_memory_usage", | 1158 state->SetInteger("gpu_memory_usage", |
| 1150 base::saturated_cast<int>(GPUMemoryUsageInBytes())); | 1159 base::saturated_cast<int>(GPUMemoryUsageInBytes())); |
| 1151 | 1160 |
| 1152 if (mutable_properties_ != MutableProperty::kNone) { | 1161 if (element_id_) |
| 1153 state->SetInteger("element_id", base::saturated_cast<int>(element_id_)); | 1162 element_id_.AddToTracedValue(state); |
| 1163 | |
| 1164 if (mutable_properties_ != MutableProperty::kNone) | |
| 1154 state->SetInteger("mutable_properties", mutable_properties_); | 1165 state->SetInteger("mutable_properties", mutable_properties_); |
| 1155 } | |
| 1156 | 1166 |
| 1157 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state); | 1167 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state); |
| 1158 | 1168 |
| 1159 if (!transform().IsIdentity()) | 1169 if (!transform().IsIdentity()) |
| 1160 MathUtil::AddToTracedValue("transform", transform(), state); | 1170 MathUtil::AddToTracedValue("transform", transform(), state); |
| 1161 | 1171 |
| 1162 bool clipped; | 1172 bool clipped; |
| 1163 gfx::QuadF layer_quad = | 1173 gfx::QuadF layer_quad = |
| 1164 MathUtil::MapQuad(ScreenSpaceTransform(), | 1174 MathUtil::MapQuad(ScreenSpaceTransform(), |
| 1165 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); | 1175 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1341 .layer_transforms_should_scale_layer_contents) { | 1351 .layer_transforms_should_scale_layer_contents) { |
| 1342 return default_scale; | 1352 return default_scale; |
| 1343 } | 1353 } |
| 1344 | 1354 |
| 1345 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( | 1355 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( |
| 1346 ScreenSpaceTransform(), default_scale); | 1356 ScreenSpaceTransform(), default_scale); |
| 1347 return std::max(transform_scales.x(), transform_scales.y()); | 1357 return std::max(transform_scales.x(), transform_scales.y()); |
| 1348 } | 1358 } |
| 1349 | 1359 |
| 1350 } // namespace cc | 1360 } // namespace cc |
| OLD | NEW |