Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: cc/layers/layer_impl.cc

Issue 2049063002: Revert of Use element id's for animations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 background_color_(0), 71 background_color_(0),
72 safe_opaque_background_color_(0), 72 safe_opaque_background_color_(0),
73 blend_mode_(SkXfermode::kSrcOver_Mode), 73 blend_mode_(SkXfermode::kSrcOver_Mode),
74 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 74 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
75 transform_tree_index_(-1), 75 transform_tree_index_(-1),
76 effect_tree_index_(-1), 76 effect_tree_index_(-1),
77 clip_tree_index_(-1), 77 clip_tree_index_(-1),
78 scroll_tree_index_(-1), 78 scroll_tree_index_(-1),
79 sorting_context_id_(0), 79 sorting_context_id_(0),
80 current_draw_mode_(DRAW_MODE_NONE), 80 current_draw_mode_(DRAW_MODE_NONE),
81 element_id_(0),
81 mutable_properties_(MutableProperty::kNone), 82 mutable_properties_(MutableProperty::kNone),
82 debug_info_(nullptr), 83 debug_info_(nullptr),
83 scrolls_drawn_descendant_(false), 84 scrolls_drawn_descendant_(false),
84 has_will_change_transform_hint_(false) { 85 has_will_change_transform_hint_(false) {
85 DCHECK_GT(layer_id_, 0); 86 DCHECK_GT(layer_id_, 0);
86 87
87 DCHECK(layer_tree_impl_); 88 DCHECK(layer_tree_impl_);
88 layer_tree_impl_->RegisterLayer(this); 89 layer_tree_impl_->RegisterLayer(this);
89 layer_tree_impl_->AddToElementMap(this); 90 layer_tree_impl_->AddToElementMap(this);
90 91
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
941 } 942 }
942 943
943 bool LayerImpl::OpacityIsAnimating() const { 944 bool LayerImpl::OpacityIsAnimating() const {
944 return layer_tree_impl_->IsAnimatingOpacityProperty(this); 945 return layer_tree_impl_->IsAnimatingOpacityProperty(this);
945 } 946 }
946 947
947 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const { 948 bool LayerImpl::HasPotentiallyRunningOpacityAnimation() const {
948 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this); 949 return layer_tree_impl_->HasPotentiallyRunningOpacityAnimation(this);
949 } 950 }
950 951
951 void LayerImpl::SetElementId(ElementId element_id) { 952 void LayerImpl::SetElementId(uint64_t element_id) {
952 if (element_id == element_id_) 953 if (element_id == element_id_)
953 return; 954 return;
954 955
955 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 956 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
956 "LayerImpl::SetElementId", "element", 957 "LayerImpl::SetElementId", "id", element_id);
957 element_id.AsValue().release());
958 958
959 layer_tree_impl_->RemoveFromElementMap(this); 959 layer_tree_impl_->RemoveFromElementMap(this);
960 element_id_ = element_id; 960 element_id_ = element_id;
961 layer_tree_impl_->AddToElementMap(this); 961 layer_tree_impl_->AddToElementMap(this);
962
963 SetNeedsPushProperties(); 962 SetNeedsPushProperties();
964 } 963 }
965 964
966 void LayerImpl::SetMutableProperties(uint32_t properties) { 965 void LayerImpl::SetMutableProperties(uint32_t properties) {
967 if (mutable_properties_ == properties) 966 if (mutable_properties_ == properties)
968 return; 967 return;
969 968
970 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 969 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
971 "LayerImpl::SetMutableProperties", "properties", properties); 970 "LayerImpl::SetMutableProperties", "properties", properties);
972 971
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 MathUtil::AddToTracedValue("bounds", bounds_, state); 1142 MathUtil::AddToTracedValue("bounds", bounds_, state);
1144 1143
1145 state->SetDouble("opacity", Opacity()); 1144 state->SetDouble("opacity", Opacity());
1146 1145
1147 MathUtil::AddToTracedValue("position", position_, state); 1146 MathUtil::AddToTracedValue("position", position_, state);
1148 1147
1149 state->SetInteger("draws_content", DrawsContent()); 1148 state->SetInteger("draws_content", DrawsContent());
1150 state->SetInteger("gpu_memory_usage", 1149 state->SetInteger("gpu_memory_usage",
1151 base::saturated_cast<int>(GPUMemoryUsageInBytes())); 1150 base::saturated_cast<int>(GPUMemoryUsageInBytes()));
1152 1151
1153 if (element_id_) 1152 if (mutable_properties_ != MutableProperty::kNone) {
1154 element_id_.AddToTracedValue(state); 1153 state->SetInteger("element_id", base::saturated_cast<int>(element_id_));
1155
1156 if (mutable_properties_ != MutableProperty::kNone)
1157 state->SetInteger("mutable_properties", mutable_properties_); 1154 state->SetInteger("mutable_properties", mutable_properties_);
1155 }
1158 1156
1159 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state); 1157 MathUtil::AddToTracedValue("scroll_offset", CurrentScrollOffset(), state);
1160 1158
1161 if (!transform().IsIdentity()) 1159 if (!transform().IsIdentity())
1162 MathUtil::AddToTracedValue("transform", transform(), state); 1160 MathUtil::AddToTracedValue("transform", transform(), state);
1163 1161
1164 bool clipped; 1162 bool clipped;
1165 gfx::QuadF layer_quad = 1163 gfx::QuadF layer_quad =
1166 MathUtil::MapQuad(ScreenSpaceTransform(), 1164 MathUtil::MapQuad(ScreenSpaceTransform(),
1167 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped); 1165 gfx::QuadF(gfx::RectF(gfx::Rect(bounds()))), &clipped);
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 .layer_transforms_should_scale_layer_contents) { 1361 .layer_transforms_should_scale_layer_contents) {
1364 return default_scale; 1362 return default_scale;
1365 } 1363 }
1366 1364
1367 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1365 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1368 ScreenSpaceTransform(), default_scale); 1366 ScreenSpaceTransform(), default_scale);
1369 return std::max(transform_scales.x(), transform_scales.y()); 1367 return std::max(transform_scales.x(), transform_scales.y());
1370 } 1368 }
1371 1369
1372 } // namespace cc 1370 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer_impl.h ('k') | cc/layers/layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698