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

Unified Diff: cc/layers/layer.cc

Issue 1139573004: Reset property tree indices when layer is removed from layer tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use sequence numbers to invalidate property tree indices. Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/layer.cc
diff --git a/cc/layers/layer.cc b/cc/layers/layer.cc
index 44679fcff16ab06fab76b2e17acdf7459885d89a..48d932d4c2f53fed0d363293f3b7b864e5f82ffa 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -53,6 +53,7 @@ Layer::Layer()
transform_tree_index_(-1),
opacity_tree_index_(-1),
clip_tree_index_(-1),
+ property_tree_sequence_number_(-1),
num_layer_or_descendants_with_copy_request_(0),
num_layer_or_descendants_with_input_handler_(0),
should_flatten_transform_from_property_tree_(false),
@@ -256,6 +257,9 @@ void Layer::SetParent(Layer* layer) {
if (!layer_tree_host_)
return;
+
+ layer_tree_host_->property_trees()->needs_rebuild = true;
+
const LayerTreeSettings& settings = layer_tree_host_->settings();
if (!settings.layer_transforms_should_scale_layer_contents)
return;
@@ -982,6 +986,57 @@ void Layer::Set3dSortingContextId(int id) {
SetNeedsCommit();
}
+void Layer::SetTransformTreeIndex(int index) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (transform_tree_index_ == index)
+ return;
+ transform_tree_index_ = index;
+ SetNeedsPushProperties();
+}
+
+int Layer::transform_tree_index() const {
+ if (!layer_tree_host_ ||
+ layer_tree_host_->property_trees()->sequence_number !=
+ property_tree_sequence_number_) {
+ return -1;
+ }
+ return transform_tree_index_;
+}
+
+void Layer::SetClipTreeIndex(int index) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (clip_tree_index_ == index)
+ return;
+ clip_tree_index_ = index;
+ SetNeedsPushProperties();
+}
+
+int Layer::clip_tree_index() const {
+ if (!layer_tree_host_ ||
+ layer_tree_host_->property_trees()->sequence_number !=
+ property_tree_sequence_number_) {
+ return -1;
+ }
+ return clip_tree_index_;
+}
+
+void Layer::SetOpacityTreeIndex(int index) {
+ DCHECK(IsPropertyChangeAllowed());
+ if (opacity_tree_index_ == index)
+ return;
+ opacity_tree_index_ = index;
+ SetNeedsPushProperties();
+}
+
+int Layer::opacity_tree_index() const {
+ if (!layer_tree_host_ ||
+ layer_tree_host_->property_trees()->sequence_number !=
+ property_tree_sequence_number_) {
+ return -1;
+ }
+ return opacity_tree_index_;
+}
+
void Layer::SetShouldFlattenTransform(bool should_flatten) {
DCHECK(IsPropertyChangeAllowed());
if (should_flatten_transform_ == should_flatten)
@@ -1126,9 +1181,9 @@ void Layer::PushPropertiesTo(LayerImpl* layer) {
DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
layer->Set3dSortingContextId(sorting_context_id_);
layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
- layer->set_transform_tree_index(transform_tree_index_);
- layer->set_opacity_tree_index(opacity_tree_index_);
- layer->set_clip_tree_index(clip_tree_index_);
+ layer->SetTransformTreeIndex(transform_tree_index());
+ layer->SetOpacityTreeIndex(opacity_tree_index());
+ layer->SetClipTreeIndex(clip_tree_index());
layer->set_offset_to_transform_parent(offset_to_transform_parent_);
layer->SetScrollClipLayer(scroll_clip_layer_id_);
« 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