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

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

Issue 1405993008: compositor-worker: plumb element id and mutable properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix rebase error. Created 5 years 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 "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/numerics/safe_conversions.h" 8 #include "base/numerics/safe_conversions.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
12 #include "cc/animation/animation_registrar.h" 12 #include "cc/animation/animation_registrar.h"
13 #include "cc/animation/mutable_properties.h"
13 #include "cc/base/math_util.h" 14 #include "cc/base/math_util.h"
14 #include "cc/base/simple_enclosed_region.h" 15 #include "cc/base/simple_enclosed_region.h"
15 #include "cc/debug/debug_colors.h" 16 #include "cc/debug/debug_colors.h"
16 #include "cc/debug/layer_tree_debug_state.h" 17 #include "cc/debug/layer_tree_debug_state.h"
17 #include "cc/debug/micro_benchmark_impl.h" 18 #include "cc/debug/micro_benchmark_impl.h"
18 #include "cc/debug/traced_value.h" 19 #include "cc/debug/traced_value.h"
19 #include "cc/input/scroll_state.h" 20 #include "cc/input/scroll_state.h"
20 #include "cc/layers/layer.h" 21 #include "cc/layers/layer.h"
21 #include "cc/layers/layer_utils.h" 22 #include "cc/layers/layer_utils.h"
22 #include "cc/output/copy_output_request.h" 23 #include "cc/output/copy_output_request.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 draw_blend_mode_(SkXfermode::kSrcOver_Mode), 79 draw_blend_mode_(SkXfermode::kSrcOver_Mode),
79 num_descendants_that_draw_content_(0), 80 num_descendants_that_draw_content_(0),
80 transform_tree_index_(-1), 81 transform_tree_index_(-1),
81 effect_tree_index_(-1), 82 effect_tree_index_(-1),
82 clip_tree_index_(-1), 83 clip_tree_index_(-1),
83 draw_depth_(0.f), 84 draw_depth_(0.f),
84 needs_push_properties_(false), 85 needs_push_properties_(false),
85 num_dependents_need_push_properties_(0), 86 num_dependents_need_push_properties_(0),
86 sorting_context_id_(0), 87 sorting_context_id_(0),
87 current_draw_mode_(DRAW_MODE_NONE), 88 current_draw_mode_(DRAW_MODE_NONE),
89 element_id_(0),
90 mutable_properties_(kMutablePropertyNone),
88 force_render_surface_(false), 91 force_render_surface_(false),
89 num_layer_or_descendants_with_copy_request_(0), 92 num_layer_or_descendants_with_copy_request_(0),
90 frame_timing_requests_dirty_(false), 93 frame_timing_requests_dirty_(false),
91 visited_(false), 94 visited_(false),
92 layer_or_descendant_is_drawn_(false), 95 layer_or_descendant_is_drawn_(false),
93 layer_or_descendant_has_input_handler_(false), 96 layer_or_descendant_has_input_handler_(false),
94 sorted_for_recursion_(false) { 97 sorted_for_recursion_(false) {
95 DCHECK_GT(layer_id_, 0); 98 DCHECK_GT(layer_id_, 0);
96 DCHECK(layer_tree_impl_); 99 DCHECK(layer_tree_impl_);
97 layer_tree_impl_->RegisterLayer(this); 100 layer_tree_impl_->RegisterLayer(this);
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 is_container_for_fixed_position_layers_); 593 is_container_for_fixed_position_layers_);
591 layer->SetPositionConstraint(position_constraint_); 594 layer->SetPositionConstraint(position_constraint_);
592 layer->SetShouldFlattenTransform(should_flatten_transform_); 595 layer->SetShouldFlattenTransform(should_flatten_transform_);
593 layer->set_should_flatten_transform_from_property_tree( 596 layer->set_should_flatten_transform_from_property_tree(
594 should_flatten_transform_from_property_tree_); 597 should_flatten_transform_from_property_tree_);
595 layer->set_draw_blend_mode(draw_blend_mode_); 598 layer->set_draw_blend_mode(draw_blend_mode_);
596 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 599 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
597 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 600 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
598 601
599 layer->SetScrollClipLayer(scroll_clip_layer_id_); 602 layer->SetScrollClipLayer(scroll_clip_layer_id_);
603 layer->SetElementId(element_id_);
604 layer->SetMutableProperties(mutable_properties_);
600 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 605 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
601 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 606 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
602 607
603 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_); 608 layer->SetScrollCompensationAdjustment(scroll_compensation_adjustment_);
604 609
605 layer->PushScrollOffset(nullptr); 610 layer->PushScrollOffset(nullptr);
606 611
607 layer->Set3dSortingContextId(sorting_context_id_); 612 layer->Set3dSortingContextId(sorting_context_id_);
608 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 613 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
609 614
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 1215
1211 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const { 1216 bool LayerImpl::OpacityIsAnimatingOnImplOnly() const {
1212 if (!layer_animation_controller_) 1217 if (!layer_animation_controller_)
1213 return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this); 1218 return layer_tree_impl_->OpacityIsAnimatingOnImplOnly(this);
1214 1219
1215 Animation* opacity_animation = 1220 Animation* opacity_animation =
1216 layer_animation_controller_->GetAnimation(Animation::OPACITY); 1221 layer_animation_controller_->GetAnimation(Animation::OPACITY);
1217 return opacity_animation && opacity_animation->is_impl_only(); 1222 return opacity_animation && opacity_animation->is_impl_only();
1218 } 1223 }
1219 1224
1225 void LayerImpl::SetElementId(uint64_t element_id) {
1226 if (element_id == element_id_)
1227 return;
1228
1229 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1230 "LayerImpl::SetElementId", "id", element_id);
1231
1232 element_id_ = element_id;
1233 SetNeedsPushProperties();
1234 }
1235
1236 void LayerImpl::SetMutableProperties(uint32_t properties) {
1237 if (mutable_properties_ == properties)
1238 return;
1239
1240 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1241 "LayerImpl::SetMutableProperties", "properties", properties);
1242
1243 mutable_properties_ = properties;
1244 SetNeedsPushProperties();
1245 }
1246
1220 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) { 1247 void LayerImpl::SetBlendMode(SkXfermode::Mode blend_mode) {
1221 if (blend_mode_ == blend_mode) 1248 if (blend_mode_ == blend_mode)
1222 return; 1249 return;
1223 1250
1224 blend_mode_ = blend_mode; 1251 blend_mode_ = blend_mode;
1225 NoteLayerPropertyChangedForSubtree(); 1252 NoteLayerPropertyChangedForSubtree();
1226 } 1253 }
1227 1254
1228 void LayerImpl::SetIsRootForIsolatedGroup(bool root) { 1255 void LayerImpl::SetIsRootForIsolatedGroup(bool root) {
1229 if (is_root_for_isolated_group_ == root) 1256 if (is_root_for_isolated_group_ == root)
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 MathUtil::AddToTracedValue("bounds", bounds_, state); 1657 MathUtil::AddToTracedValue("bounds", bounds_, state);
1631 1658
1632 state->SetDouble("opacity", opacity()); 1659 state->SetDouble("opacity", opacity());
1633 1660
1634 MathUtil::AddToTracedValue("position", position_, state); 1661 MathUtil::AddToTracedValue("position", position_, state);
1635 1662
1636 state->SetInteger("draws_content", DrawsContent()); 1663 state->SetInteger("draws_content", DrawsContent());
1637 state->SetInteger("gpu_memory_usage", 1664 state->SetInteger("gpu_memory_usage",
1638 base::saturated_cast<int>(GPUMemoryUsageInBytes())); 1665 base::saturated_cast<int>(GPUMemoryUsageInBytes()));
1639 1666
1667 if (mutable_properties_ != kMutablePropertyNone) {
1668 state->SetInteger("element_id", base::saturated_cast<int>(element_id_));
1669 state->SetInteger("mutable_properties", mutable_properties_);
1670 }
1671
1640 MathUtil::AddToTracedValue( 1672 MathUtil::AddToTracedValue(
1641 "scroll_offset", scroll_offset_ ? scroll_offset_->Current(IsActive()) 1673 "scroll_offset", scroll_offset_ ? scroll_offset_->Current(IsActive())
1642 : gfx::ScrollOffset(), 1674 : gfx::ScrollOffset(),
1643 state); 1675 state);
1644 1676
1645 MathUtil::AddToTracedValue("transform_origin", transform_origin_, state); 1677 MathUtil::AddToTracedValue("transform_origin", transform_origin_, state);
1646 1678
1647 bool clipped; 1679 bool clipped;
1648 gfx::QuadF layer_quad = 1680 gfx::QuadF layer_quad =
1649 MathUtil::MapQuad(ScreenSpaceTransform(), 1681 MathUtil::MapQuad(ScreenSpaceTransform(),
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1847 .layer_transforms_should_scale_layer_contents) { 1879 .layer_transforms_should_scale_layer_contents) {
1848 return default_scale; 1880 return default_scale;
1849 } 1881 }
1850 1882
1851 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents( 1883 gfx::Vector2dF transform_scales = MathUtil::ComputeTransform2dScaleComponents(
1852 DrawTransform(), default_scale); 1884 DrawTransform(), default_scale);
1853 return std::max(transform_scales.x(), transform_scales.y()); 1885 return std::max(transform_scales.x(), transform_scales.y());
1854 } 1886 }
1855 1887
1856 } // namespace cc 1888 } // 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