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

Side by Side Diff: cc/layers/layer.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.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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/atomic_sequence_num.h" 12 #include "base/atomic_sequence_num.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/metrics/histogram.h" 14 #include "base/metrics/histogram.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "cc/animation/animation_host.h"
19 #include "cc/animation/mutable_properties.h" 18 #include "cc/animation/mutable_properties.h"
20 #include "cc/base/simple_enclosed_region.h" 19 #include "cc/base/simple_enclosed_region.h"
21 #include "cc/debug/frame_viewer_instrumentation.h" 20 #include "cc/debug/frame_viewer_instrumentation.h"
22 #include "cc/input/main_thread_scrolling_reason.h" 21 #include "cc/input/main_thread_scrolling_reason.h"
23 #include "cc/layers/layer_client.h" 22 #include "cc/layers/layer_client.h"
24 #include "cc/layers/layer_impl.h" 23 #include "cc/layers/layer_impl.h"
25 #include "cc/layers/layer_proto_converter.h" 24 #include "cc/layers/layer_proto_converter.h"
26 #include "cc/layers/scrollbar_layer_interface.h" 25 #include "cc/layers/scrollbar_layer_interface.h"
27 #include "cc/output/copy_output_request.h" 26 #include "cc/output/copy_output_request.h"
28 #include "cc/output/copy_output_result.h" 27 #include "cc/output/copy_output_result.h"
(...skipping 23 matching lines...) Expand all
52 sorting_context_id_(0), 51 sorting_context_id_(0),
53 parent_(nullptr), 52 parent_(nullptr),
54 layer_tree_host_(nullptr), 53 layer_tree_host_(nullptr),
55 scroll_clip_layer_id_(INVALID_ID), 54 scroll_clip_layer_id_(INVALID_ID),
56 num_descendants_that_draw_content_(0), 55 num_descendants_that_draw_content_(0),
57 transform_tree_index_(-1), 56 transform_tree_index_(-1),
58 effect_tree_index_(-1), 57 effect_tree_index_(-1),
59 clip_tree_index_(-1), 58 clip_tree_index_(-1),
60 scroll_tree_index_(-1), 59 scroll_tree_index_(-1),
61 property_tree_sequence_number_(-1), 60 property_tree_sequence_number_(-1),
61 element_id_(0),
62 mutable_properties_(MutableProperty::kNone), 62 mutable_properties_(MutableProperty::kNone),
63 main_thread_scrolling_reasons_( 63 main_thread_scrolling_reasons_(
64 MainThreadScrollingReason::kNotScrollingOnMain), 64 MainThreadScrollingReason::kNotScrollingOnMain),
65 should_flatten_transform_from_property_tree_(false), 65 should_flatten_transform_from_property_tree_(false),
66 user_scrollable_horizontal_(true), 66 user_scrollable_horizontal_(true),
67 user_scrollable_vertical_(true), 67 user_scrollable_vertical_(true),
68 is_root_for_isolated_group_(false), 68 is_root_for_isolated_group_(false),
69 is_container_for_fixed_position_layers_(false), 69 is_container_for_fixed_position_layers_(false),
70 is_drawable_(false), 70 is_drawable_(false),
71 draws_content_(false), 71 draws_content_(false),
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 } 115 }
116 116
117 void Layer::SetLayerTreeHost(LayerTreeHost* host) { 117 void Layer::SetLayerTreeHost(LayerTreeHost* host) {
118 if (layer_tree_host_ == host) 118 if (layer_tree_host_ == host)
119 return; 119 return;
120 120
121 if (layer_tree_host_) { 121 if (layer_tree_host_) {
122 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id()); 122 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id());
123 layer_tree_host_->property_trees()->needs_rebuild = true; 123 layer_tree_host_->property_trees()->needs_rebuild = true;
124 layer_tree_host_->UnregisterLayer(this); 124 layer_tree_host_->UnregisterLayer(this);
125 if (element_id_) {
126 layer_tree_host_->animation_host()->UnregisterElement(
127 element_id_, ElementListType::ACTIVE);
128 layer_tree_host_->RemoveFromElementMap(this);
129 }
130 } 125 }
131 if (host) { 126 if (host) {
132 host->property_trees()->needs_rebuild = true; 127 host->property_trees()->needs_rebuild = true;
133 host->RegisterLayer(this); 128 host->RegisterLayer(this);
134 if (element_id_) {
135 host->AddToElementMap(this);
136 host->animation_host()->RegisterElement(element_id_,
137 ElementListType::ACTIVE);
138 }
139 } 129 }
140 130
141 layer_tree_host_ = host; 131 layer_tree_host_ = host;
142 InvalidatePropertyTreesIndices(); 132 InvalidatePropertyTreesIndices();
143 133
144 // When changing hosts, the layer needs to commit its properties to the impl 134 // When changing hosts, the layer needs to commit its properties to the impl
145 // side for the new host. 135 // side for the new host.
146 SetNeedsPushProperties(); 136 SetNeedsPushProperties();
147 137
148 for (size_t i = 0; i < children_.size(); ++i) 138 for (size_t i = 0; i < children_.size(); ++i)
(...skipping 1646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1795 num_descendants_that_draw_content_ += num; 1785 num_descendants_that_draw_content_ += num;
1796 SetNeedsCommit(); 1786 SetNeedsCommit();
1797 if (parent()) 1787 if (parent())
1798 parent()->AddDrawableDescendants(num); 1788 parent()->AddDrawableDescendants(num);
1799 } 1789 }
1800 1790
1801 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) { 1791 void Layer::RunMicroBenchmark(MicroBenchmark* benchmark) {
1802 benchmark->RunOnLayer(this); 1792 benchmark->RunOnLayer(this);
1803 } 1793 }
1804 1794
1805 void Layer::SetElementId(ElementId id) { 1795 void Layer::SetElementId(uint64_t id) {
1806 DCHECK(IsPropertyChangeAllowed()); 1796 DCHECK(IsPropertyChangeAllowed());
1807 if (element_id_ == id) 1797 if (element_id_ == id)
1808 return; 1798 return;
1809 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 1799 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1810 "Layer::SetElementId", "element", id.AsValue().release()); 1800 "Layer::SetElementId", "id", id);
1811 if (element_id_ && layer_tree_host()) {
1812 layer_tree_host()->animation_host()->UnregisterElement(
1813 element_id_, ElementListType::ACTIVE);
1814 layer_tree_host()->RemoveFromElementMap(this);
1815 }
1816
1817 element_id_ = id; 1801 element_id_ = id;
1818
1819 if (element_id_ && layer_tree_host()) {
1820 layer_tree_host()->animation_host()->RegisterElement(
1821 element_id_, ElementListType::ACTIVE);
1822 layer_tree_host()->AddToElementMap(this);
1823 }
1824
1825 SetNeedsCommit(); 1802 SetNeedsCommit();
1826 } 1803 }
1827 1804
1828 void Layer::SetMutableProperties(uint32_t properties) { 1805 void Layer::SetMutableProperties(uint32_t properties) {
1829 DCHECK(IsPropertyChangeAllowed()); 1806 DCHECK(IsPropertyChangeAllowed());
1830 if (mutable_properties_ == properties) 1807 if (mutable_properties_ == properties)
1831 return; 1808 return;
1832 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"), 1809 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("compositor-worker"),
1833 "Layer::SetMutableProperties", "properties", properties); 1810 "Layer::SetMutableProperties", "properties", properties);
1834 mutable_properties_ = properties; 1811 mutable_properties_ = properties;
(...skipping 15 matching lines...) Expand all
1850 ->data.num_copy_requests_in_subtree; 1827 ->data.num_copy_requests_in_subtree;
1851 } 1828 }
1852 1829
1853 gfx::Transform Layer::screen_space_transform() const { 1830 gfx::Transform Layer::screen_space_transform() const {
1854 DCHECK_NE(transform_tree_index_, -1); 1831 DCHECK_NE(transform_tree_index_, -1);
1855 return draw_property_utils::ScreenSpaceTransform( 1832 return draw_property_utils::ScreenSpaceTransform(
1856 this, layer_tree_host_->property_trees()->transform_tree); 1833 this, layer_tree_host_->property_trees()->transform_tree);
1857 } 1834 }
1858 1835
1859 } // namespace cc 1836 } // 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