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

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

Issue 1166233002: Rebuild PropertyTrees When Layer Attach to New LayerTreeHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@implon
Patch Set: Created 5 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') | no next file » | 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/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 } 126 }
127 127
128 void Layer::SetLayerTreeHost(LayerTreeHost* host) { 128 void Layer::SetLayerTreeHost(LayerTreeHost* host) {
129 if (layer_tree_host_ == host) 129 if (layer_tree_host_ == host)
130 return; 130 return;
131 131
132 if (layer_tree_host_) 132 if (layer_tree_host_)
133 layer_tree_host_->property_trees()->needs_rebuild = true; 133 layer_tree_host_->property_trees()->needs_rebuild = true;
134 134
135 if (host)
136 host->property_trees()->needs_rebuild = true;
137
138 InvalidatePropertyTreesIndices();
Ian Vollick 2015/06/09 00:18:51 Is there a chance that we're detaching/attaching a
139
135 layer_tree_host_ = host; 140 layer_tree_host_ = host;
136 141
137 // When changing hosts, the layer needs to commit its properties to the impl 142 // When changing hosts, the layer needs to commit its properties to the impl
138 // side for the new host. 143 // side for the new host.
139 SetNeedsPushProperties(); 144 SetNeedsPushProperties();
140 145
141 for (size_t i = 0; i < children_.size(); ++i) 146 for (size_t i = 0; i < children_.size(); ++i)
142 children_[i]->SetLayerTreeHost(host); 147 children_[i]->SetLayerTreeHost(host);
143 148
144 if (mask_layer_.get()) 149 if (mask_layer_.get())
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 1051
1047 int Layer::opacity_tree_index() const { 1052 int Layer::opacity_tree_index() const {
1048 if (!layer_tree_host_ || 1053 if (!layer_tree_host_ ||
1049 layer_tree_host_->property_trees()->sequence_number != 1054 layer_tree_host_->property_trees()->sequence_number !=
1050 property_tree_sequence_number_) { 1055 property_tree_sequence_number_) {
1051 return -1; 1056 return -1;
1052 } 1057 }
1053 return opacity_tree_index_; 1058 return opacity_tree_index_;
1054 } 1059 }
1055 1060
1061 void Layer::InvalidatePropertyTreesIndices() {
1062 int invalid_property_tree_index = -1;
1063 SetTransformTreeIndex(invalid_property_tree_index);
1064 SetClipTreeIndex(invalid_property_tree_index);
1065 SetOpacityTreeIndex(invalid_property_tree_index);
1066 }
1067
1056 void Layer::SetShouldFlattenTransform(bool should_flatten) { 1068 void Layer::SetShouldFlattenTransform(bool should_flatten) {
1057 DCHECK(IsPropertyChangeAllowed()); 1069 DCHECK(IsPropertyChangeAllowed());
1058 if (should_flatten_transform_ == should_flatten) 1070 if (should_flatten_transform_ == should_flatten)
1059 return; 1071 return;
1060 should_flatten_transform_ = should_flatten; 1072 should_flatten_transform_ = should_flatten;
1061 SetNeedsCommit(); 1073 SetNeedsCommit();
1062 } 1074 }
1063 1075
1064 void Layer::SetIsDrawable(bool is_drawable) { 1076 void Layer::SetIsDrawable(bool is_drawable) {
1065 DCHECK(IsPropertyChangeAllowed()); 1077 DCHECK(IsPropertyChangeAllowed());
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
1647 ? layer_tree_host()->meta_information_sequence_number() 1659 ? layer_tree_host()->meta_information_sequence_number()
1648 : 0; 1660 : 0;
1649 } 1661 }
1650 1662
1651 bool Layer::sorted_for_recursion() { 1663 bool Layer::sorted_for_recursion() {
1652 return sorted_for_recursion_tracker_ == 1664 return sorted_for_recursion_tracker_ ==
1653 layer_tree_host()->meta_information_sequence_number(); 1665 layer_tree_host()->meta_information_sequence_number();
1654 } 1666 }
1655 1667
1656 } // namespace cc 1668 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/layer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698