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

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: . 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/trees/layer_tree_host_common_unittest.cc » ('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..78c8591841a5f26301907ca5aefad47e765c557e 100644
--- a/cc/layers/layer.cc
+++ b/cc/layers/layer.cc
@@ -254,8 +254,14 @@ void Layer::SetParent(Layer* layer) {
parent_ = layer;
SetLayerTreeHost(parent_ ? parent_->layer_tree_host() : nullptr);
+ if (!layer)
+ InvalidatePropertyTreeIndices();
ajuma 2015/05/20 13:54:03 I'm a bit worried about the perf impact of this. I
+
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;
@@ -1520,4 +1526,15 @@ void Layer::DidBeginTracing() {
SetNeedsPushProperties();
}
+void Layer::InvalidatePropertyTreeIndices() {
+ transform_tree_index_ = -1;
+ clip_tree_index_ = -1;
+ opacity_tree_index_ = -1;
+
+ for (size_t i = 0; i < children().size(); ++i) {
+ Layer* child_layer = child_at(i);
+ child_layer->InvalidatePropertyTreeIndices();
+ }
+}
+
} // namespace cc
« no previous file with comments | « cc/layers/layer.h ('k') | cc/trees/layer_tree_host_common_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698