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

Side by Side Diff: cc/layers/layer.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.h ('k') | cc/layers/layer_impl.h » ('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 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "cc/animation/animation.h" 15 #include "cc/animation/animation.h"
16 #include "cc/animation/animation_events.h" 16 #include "cc/animation/animation_events.h"
17 #include "cc/animation/animation_registrar.h" 17 #include "cc/animation/animation_registrar.h"
18 #include "cc/animation/keyframed_animation_curve.h" 18 #include "cc/animation/keyframed_animation_curve.h"
19 #include "cc/animation/layer_animation_controller.h" 19 #include "cc/animation/layer_animation_controller.h"
20 #include "cc/animation/mutable_properties.h"
20 #include "cc/base/simple_enclosed_region.h" 21 #include "cc/base/simple_enclosed_region.h"
21 #include "cc/debug/frame_viewer_instrumentation.h" 22 #include "cc/debug/frame_viewer_instrumentation.h"
22 #include "cc/layers/layer_client.h" 23 #include "cc/layers/layer_client.h"
23 #include "cc/layers/layer_impl.h" 24 #include "cc/layers/layer_impl.h"
24 #include "cc/layers/layer_proto_converter.h" 25 #include "cc/layers/layer_proto_converter.h"
25 #include "cc/layers/layer_settings.h" 26 #include "cc/layers/layer_settings.h"
26 #include "cc/layers/scrollbar_layer_interface.h" 27 #include "cc/layers/scrollbar_layer_interface.h"
27 #include "cc/output/copy_output_request.h" 28 #include "cc/output/copy_output_request.h"
28 #include "cc/output/copy_output_result.h" 29 #include "cc/output/copy_output_result.h"
29 #include "cc/proto/layer.pb.h" 30 #include "cc/proto/layer.pb.h"
(...skipping 22 matching lines...) Expand all
52 sorting_context_id_(0), 53 sorting_context_id_(0),
53 parent_(nullptr), 54 parent_(nullptr),
54 layer_tree_host_(nullptr), 55 layer_tree_host_(nullptr),
55 scroll_clip_layer_id_(INVALID_ID), 56 scroll_clip_layer_id_(INVALID_ID),
56 num_descendants_that_draw_content_(0), 57 num_descendants_that_draw_content_(0),
57 transform_tree_index_(-1), 58 transform_tree_index_(-1),
58 effect_tree_index_(-1), 59 effect_tree_index_(-1),
59 clip_tree_index_(-1), 60 clip_tree_index_(-1),
60 property_tree_sequence_number_(-1), 61 property_tree_sequence_number_(-1),
61 num_layer_or_descendants_with_copy_request_(0), 62 num_layer_or_descendants_with_copy_request_(0),
63 element_id_(0),
64 mutable_properties_(kMutablePropertyNone),
62 should_flatten_transform_from_property_tree_(false), 65 should_flatten_transform_from_property_tree_(false),
63 should_scroll_on_main_thread_(false), 66 should_scroll_on_main_thread_(false),
64 have_wheel_event_handlers_(false), 67 have_wheel_event_handlers_(false),
65 have_scroll_event_handlers_(false), 68 have_scroll_event_handlers_(false),
66 user_scrollable_horizontal_(true), 69 user_scrollable_horizontal_(true),
67 user_scrollable_vertical_(true), 70 user_scrollable_vertical_(true),
68 is_root_for_isolated_group_(false), 71 is_root_for_isolated_group_(false),
69 is_container_for_fixed_position_layers_(false), 72 is_container_for_fixed_position_layers_(false),
70 is_drawable_(false), 73 is_drawable_(false),
71 draws_content_(false), 74 draws_content_(false),
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1234 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 1237 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
1235 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) 1238 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
1236 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 1239 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
1237 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); 1240 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
1238 layer->Set3dSortingContextId(sorting_context_id_); 1241 layer->Set3dSortingContextId(sorting_context_id_);
1239 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 1242 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
1240 1243
1241 layer->SetScrollClipLayer(scroll_clip_layer_id_); 1244 layer->SetScrollClipLayer(scroll_clip_layer_id_);
1242 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 1245 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
1243 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 1246 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
1247 layer->SetElementId(element_id_);
1248 layer->SetMutableProperties(mutable_properties_);
1244 1249
1245 LayerImpl* scroll_parent = nullptr; 1250 LayerImpl* scroll_parent = nullptr;
1246 if (scroll_parent_) { 1251 if (scroll_parent_) {
1247 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 1252 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
1248 DCHECK(scroll_parent); 1253 DCHECK(scroll_parent);
1249 } 1254 }
1250 1255
1251 layer->SetScrollParent(scroll_parent); 1256 layer->SetScrollParent(scroll_parent);
1252 if (scroll_children_) { 1257 if (scroll_children_) {
1253 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>; 1258 std::set<LayerImpl*>* scroll_children = new std::set<LayerImpl*>;
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1770 void Layer::SetFrameTimingRequests( 1775 void Layer::SetFrameTimingRequests(
1771 const std::vector<FrameTimingRequest>& requests) { 1776 const std::vector<FrameTimingRequest>& requests) {
1772 // TODO(vmpstr): Early out if there are no changes earlier in the call stack. 1777 // TODO(vmpstr): Early out if there are no changes earlier in the call stack.
1773 if (requests == frame_timing_requests_) 1778 if (requests == frame_timing_requests_)
1774 return; 1779 return;
1775 frame_timing_requests_ = requests; 1780 frame_timing_requests_ = requests;
1776 frame_timing_requests_dirty_ = true; 1781 frame_timing_requests_dirty_ = true;
1777 SetNeedsCommit(); 1782 SetNeedsCommit();
1778 } 1783 }
1779 1784
1785 void Layer::SetElementId(uint64_t id) {
1786 DCHECK(IsPropertyChangeAllowed());
1787 if (element_id_ == id)
1788 return;
1789 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1790 "Layer::SetElementId", "id", id);
1791 element_id_ = id;
1792 SetNeedsCommit();
1793 }
1794
1795 void Layer::SetMutableProperties(uint32_t properties) {
1796 DCHECK(IsPropertyChangeAllowed());
1797 if (mutable_properties_ == properties)
1798 return;
1799 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1800 "Layer::SetMutableProperties", "properties", properties);
1801 mutable_properties_ = properties;
1802 SetNeedsCommit();
1803 }
1804
1780 void Layer::DidBeginTracing() { 1805 void Layer::DidBeginTracing() {
1781 // We'll be dumping layer trees as part of trace, so make sure 1806 // We'll be dumping layer trees as part of trace, so make sure
1782 // PushPropertiesTo() propagates layer debug info to the impl 1807 // PushPropertiesTo() propagates layer debug info to the impl
1783 // side -- otherwise this won't happen for the the layers that 1808 // side -- otherwise this won't happen for the the layers that
1784 // remain unchanged since tracing started. 1809 // remain unchanged since tracing started.
1785 SetNeedsPushProperties(); 1810 SetNeedsPushProperties();
1786 } 1811 }
1787 1812
1788 void Layer::set_visited(bool visited) { 1813 void Layer::set_visited(bool visited) {
1789 visited_tracker_ = 1814 visited_tracker_ =
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 this, layer_tree_host_->property_trees()->transform_tree); 1851 this, layer_tree_host_->property_trees()->transform_tree);
1827 } 1852 }
1828 1853
1829 gfx::Transform Layer::screen_space_transform() const { 1854 gfx::Transform Layer::screen_space_transform() const {
1830 DCHECK_NE(transform_tree_index_, -1); 1855 DCHECK_NE(transform_tree_index_, -1);
1831 return ScreenSpaceTransformFromPropertyTrees( 1856 return ScreenSpaceTransformFromPropertyTrees(
1832 this, layer_tree_host_->property_trees()->transform_tree); 1857 this, layer_tree_host_->property_trees()->transform_tree);
1833 } 1858 }
1834 1859
1835 } // namespace cc 1860 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698