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

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

Issue 23702010: Revert 220418 "cc: Block commit on activate by setting a flag on..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/cc/layers/layer.h ('k') | trunk/src/cc/layers/texture_layer.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/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 layer_tree_host_->SetNeedsCommit(); 145 layer_tree_host_->SetNeedsCommit();
146 } 146 }
147 147
148 void Layer::SetNeedsFullTreeSync() { 148 void Layer::SetNeedsFullTreeSync() {
149 if (!layer_tree_host_) 149 if (!layer_tree_host_)
150 return; 150 return;
151 151
152 layer_tree_host_->SetNeedsFullTreeSync(); 152 layer_tree_host_->SetNeedsFullTreeSync();
153 } 153 }
154 154
155 void Layer::SetNextCommitWaitsForActivation() { 155 bool Layer::IsPropertyChangeAllowed() const {
156 if (!layer_tree_host_) 156 if (!layer_tree_host_)
157 return; 157 return true;
158 158
159 layer_tree_host_->SetNextCommitWaitsForActivation(); 159 if (!layer_tree_host_->settings().strict_layer_property_change_checking)
160 return true;
161
162 return !layer_tree_host_->in_paint_layer_contents();
160 } 163 }
161 164
162 void Layer::SetNeedsPushProperties() { 165 void Layer::SetNeedsPushProperties() {
163 if (needs_push_properties_) 166 if (needs_push_properties_)
164 return; 167 return;
165 if (!parent_should_know_need_push_properties() && parent_) 168 if (!parent_should_know_need_push_properties() && parent_)
166 parent_->AddDependentNeedsPushProperties(); 169 parent_->AddDependentNeedsPushProperties();
167 needs_push_properties_ = true; 170 needs_push_properties_ = true;
168 } 171 }
169 172
170 void Layer::AddDependentNeedsPushProperties() { 173 void Layer::AddDependentNeedsPushProperties() {
171 DCHECK_GE(num_dependents_need_push_properties_, 0); 174 DCHECK_GE(num_dependents_need_push_properties_, 0);
172 175
173 if (!parent_should_know_need_push_properties() && parent_) 176 if (!parent_should_know_need_push_properties() && parent_)
174 parent_->AddDependentNeedsPushProperties(); 177 parent_->AddDependentNeedsPushProperties();
175 178
176 num_dependents_need_push_properties_++; 179 num_dependents_need_push_properties_++;
177 } 180 }
178 181
179 void Layer::RemoveDependentNeedsPushProperties() { 182 void Layer::RemoveDependentNeedsPushProperties() {
180 num_dependents_need_push_properties_--; 183 num_dependents_need_push_properties_--;
181 DCHECK_GE(num_dependents_need_push_properties_, 0); 184 DCHECK_GE(num_dependents_need_push_properties_, 0);
182 185
183 if (!parent_should_know_need_push_properties() && parent_) 186 if (!parent_should_know_need_push_properties() && parent_)
184 parent_->RemoveDependentNeedsPushProperties(); 187 parent_->RemoveDependentNeedsPushProperties();
185 } 188 }
186 189
187 bool Layer::IsPropertyChangeAllowed() const {
188 if (!layer_tree_host_)
189 return true;
190
191 if (!layer_tree_host_->settings().strict_layer_property_change_checking)
192 return true;
193
194 return !layer_tree_host_->in_paint_layer_contents();
195 }
196
197 gfx::Rect Layer::LayerRectToContentRect(const gfx::RectF& layer_rect) const { 190 gfx::Rect Layer::LayerRectToContentRect(const gfx::RectF& layer_rect) const {
198 gfx::RectF content_rect = 191 gfx::RectF content_rect =
199 gfx::ScaleRect(layer_rect, contents_scale_x(), contents_scale_y()); 192 gfx::ScaleRect(layer_rect, contents_scale_x(), contents_scale_y());
200 // Intersect with content rect to avoid the extra pixel because for some 193 // Intersect with content rect to avoid the extra pixel because for some
201 // values x and y, ceil((x / y) * y) may be x + 1. 194 // values x and y, ceil((x / y) * y) may be x + 1.
202 content_rect.Intersect(gfx::Rect(content_bounds())); 195 content_rect.Intersect(gfx::Rect(content_bounds()));
203 return gfx::ToEnclosingRect(content_rect); 196 return gfx::ToEnclosingRect(content_rect);
204 } 197 }
205 198
199 bool Layer::BlocksPendingCommit() const {
200 return false;
201 }
202
206 skia::RefPtr<SkPicture> Layer::GetPicture() const { 203 skia::RefPtr<SkPicture> Layer::GetPicture() const {
207 return skia::RefPtr<SkPicture>(); 204 return skia::RefPtr<SkPicture>();
208 } 205 }
209 206
210 bool Layer::CanClipSelf() const { 207 bool Layer::CanClipSelf() const {
211 return false; 208 return false;
212 } 209 }
213 210
211 bool Layer::BlocksPendingCommitRecursive() const {
212 if (BlocksPendingCommit())
213 return true;
214 if (mask_layer() && mask_layer()->BlocksPendingCommitRecursive())
215 return true;
216 if (replica_layer() && replica_layer()->BlocksPendingCommitRecursive())
217 return true;
218 for (size_t i = 0; i < children_.size(); ++i) {
219 if (children_[i]->BlocksPendingCommitRecursive())
220 return true;
221 }
222 return false;
223 }
224
214 void Layer::SetParent(Layer* layer) { 225 void Layer::SetParent(Layer* layer) {
215 DCHECK(!layer || !layer->HasAncestor(this)); 226 DCHECK(!layer || !layer->HasAncestor(this));
216 227
217 if (parent_should_know_need_push_properties()) { 228 if (parent_should_know_need_push_properties()) {
218 if (parent_) 229 if (parent_)
219 parent_->RemoveDependentNeedsPushProperties(); 230 parent_->RemoveDependentNeedsPushProperties();
220 if (layer) 231 if (layer)
221 layer->AddDependentNeedsPushProperties(); 232 layer->AddDependentNeedsPushProperties();
222 } 233 }
223 234
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 (*it)->clip_parent_ = NULL; 1103 (*it)->clip_parent_ = NULL;
1093 } 1104 }
1094 1105
1095 if (clip_parent_) 1106 if (clip_parent_)
1096 clip_parent_->RemoveClipChild(this); 1107 clip_parent_->RemoveClipChild(this);
1097 1108
1098 clip_parent_ = NULL; 1109 clip_parent_ = NULL;
1099 } 1110 }
1100 1111
1101 } // namespace cc 1112 } // namespace cc
OLDNEW
« no previous file with comments | « trunk/src/cc/layers/layer.h ('k') | trunk/src/cc/layers/texture_layer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698