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

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

Issue 2888483002: Manage registering composited elements in PaintArtifactCompositor. (Closed)
Patch Set: Sync to head and disable flaky animation test. Created 3 years, 7 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 | « no previous file | cc/layers/layer_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 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>
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 118
119 void Layer::SetLayerTreeHost(LayerTreeHost* host) { 119 void Layer::SetLayerTreeHost(LayerTreeHost* host) {
120 if (layer_tree_host_ == host) 120 if (layer_tree_host_ == host)
121 return; 121 return;
122 122
123 if (layer_tree_host_) { 123 if (layer_tree_host_) {
124 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id()); 124 layer_tree_host_->property_trees()->RemoveIdFromIdToIndexMaps(id());
125 layer_tree_host_->property_trees()->needs_rebuild = true; 125 layer_tree_host_->property_trees()->needs_rebuild = true;
126 layer_tree_host_->UnregisterLayer(this); 126 layer_tree_host_->UnregisterLayer(this);
127 if (inputs_.element_id) { 127 if (!layer_tree_host_->GetSettings().use_layer_lists &&
128 inputs_.element_id) {
128 layer_tree_host_->UnregisterElement(inputs_.element_id, 129 layer_tree_host_->UnregisterElement(inputs_.element_id,
129 ElementListType::ACTIVE, this); 130 ElementListType::ACTIVE, this);
130 } 131 }
131 } 132 }
132 if (host) { 133 if (host) {
133 host->property_trees()->needs_rebuild = true; 134 host->property_trees()->needs_rebuild = true;
134 host->RegisterLayer(this); 135 host->RegisterLayer(this);
135 if (inputs_.element_id) { 136 if (!host->GetSettings().use_layer_lists && inputs_.element_id) {
136 host->RegisterElement(inputs_.element_id, ElementListType::ACTIVE, this); 137 host->RegisterElement(inputs_.element_id, ElementListType::ACTIVE, this);
137 } 138 }
138 } 139 }
139 140
140 layer_tree_host_ = host; 141 layer_tree_host_ = host;
141 InvalidatePropertyTreesIndices(); 142 InvalidatePropertyTreesIndices();
142 143
143 // When changing hosts, the layer needs to commit its properties to the impl 144 // When changing hosts, the layer needs to commit its properties to the impl
144 // side for the new host. 145 // side for the new host.
145 SetNeedsPushProperties(); 146 SetNeedsPushProperties();
146 147
147 for (size_t i = 0; i < inputs_.children.size(); ++i) 148 for (size_t i = 0; i < inputs_.children.size(); ++i)
148 inputs_.children[i]->SetLayerTreeHost(host); 149 inputs_.children[i]->SetLayerTreeHost(host);
149 150
150 if (inputs_.mask_layer.get()) 151 if (inputs_.mask_layer.get())
151 inputs_.mask_layer->SetLayerTreeHost(host); 152 inputs_.mask_layer->SetLayerTreeHost(host);
152 153
153 const bool has_any_animation = 154 if (host && !host->GetSettings().use_layer_lists &&
154 layer_tree_host_ ? GetMutatorHost()->HasAnyAnimation(element_id()) 155 GetMutatorHost()->HasAnyAnimation(element_id())) {
155 : false;
156
157 if (host && has_any_animation)
158 host->SetNeedsCommit(); 156 host->SetNeedsCommit();
157 }
159 } 158 }
160 159
161 void Layer::SetNeedsCommit() { 160 void Layer::SetNeedsCommit() {
162 if (!layer_tree_host_) 161 if (!layer_tree_host_)
163 return; 162 return;
164 163
165 SetNeedsPushProperties(); 164 SetNeedsPushProperties();
166 165
167 if (ignore_set_needs_commit_) 166 if (ignore_set_needs_commit_)
168 return; 167 return;
(...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after
1428 ->subtree_has_copy_request; 1427 ->subtree_has_copy_request;
1429 } 1428 }
1430 1429
1431 gfx::Transform Layer::ScreenSpaceTransform() const { 1430 gfx::Transform Layer::ScreenSpaceTransform() const {
1432 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId); 1431 DCHECK_NE(transform_tree_index_, TransformTree::kInvalidNodeId);
1433 return draw_property_utils::ScreenSpaceTransform( 1432 return draw_property_utils::ScreenSpaceTransform(
1434 this, layer_tree_host_->property_trees()->transform_tree); 1433 this, layer_tree_host_->property_trees()->transform_tree);
1435 } 1434 }
1436 1435
1437 } // namespace cc 1436 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | cc/layers/layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698