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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « cc/layers/layer.h ('k') | cc/layers/layer_impl.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/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 layer_id_(g_next_layer_id.GetNext() + 1), 46 layer_id_(g_next_layer_id.GetNext() + 1),
47 ignore_set_needs_commit_(false), 47 ignore_set_needs_commit_(false),
48 sorting_context_id_(0), 48 sorting_context_id_(0),
49 parent_(nullptr), 49 parent_(nullptr),
50 layer_tree_host_(nullptr), 50 layer_tree_host_(nullptr),
51 scroll_clip_layer_id_(INVALID_ID), 51 scroll_clip_layer_id_(INVALID_ID),
52 num_descendants_that_draw_content_(0), 52 num_descendants_that_draw_content_(0),
53 transform_tree_index_(-1), 53 transform_tree_index_(-1),
54 opacity_tree_index_(-1), 54 opacity_tree_index_(-1),
55 clip_tree_index_(-1), 55 clip_tree_index_(-1),
56 property_tree_sequence_number_(-1),
56 num_layer_or_descendants_with_copy_request_(0), 57 num_layer_or_descendants_with_copy_request_(0),
57 num_layer_or_descendants_with_input_handler_(0), 58 num_layer_or_descendants_with_input_handler_(0),
58 should_flatten_transform_from_property_tree_(false), 59 should_flatten_transform_from_property_tree_(false),
59 should_scroll_on_main_thread_(false), 60 should_scroll_on_main_thread_(false),
60 have_wheel_event_handlers_(false), 61 have_wheel_event_handlers_(false),
61 have_scroll_event_handlers_(false), 62 have_scroll_event_handlers_(false),
62 user_scrollable_horizontal_(true), 63 user_scrollable_horizontal_(true),
63 user_scrollable_vertical_(true), 64 user_scrollable_vertical_(true),
64 is_root_for_isolated_group_(false), 65 is_root_for_isolated_group_(false),
65 is_container_for_fixed_position_layers_(false), 66 is_container_for_fixed_position_layers_(false),
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 parent_->RemoveDependentNeedsPushProperties(); 250 parent_->RemoveDependentNeedsPushProperties();
250 if (layer) 251 if (layer)
251 layer->AddDependentNeedsPushProperties(); 252 layer->AddDependentNeedsPushProperties();
252 } 253 }
253 254
254 parent_ = layer; 255 parent_ = layer;
255 SetLayerTreeHost(parent_ ? parent_->layer_tree_host() : nullptr); 256 SetLayerTreeHost(parent_ ? parent_->layer_tree_host() : nullptr);
256 257
257 if (!layer_tree_host_) 258 if (!layer_tree_host_)
258 return; 259 return;
260
261 layer_tree_host_->property_trees()->needs_rebuild = true;
262
259 const LayerTreeSettings& settings = layer_tree_host_->settings(); 263 const LayerTreeSettings& settings = layer_tree_host_->settings();
260 if (!settings.layer_transforms_should_scale_layer_contents) 264 if (!settings.layer_transforms_should_scale_layer_contents)
261 return; 265 return;
262 266
263 reset_raster_scale_to_unknown(); 267 reset_raster_scale_to_unknown();
264 if (mask_layer_.get()) 268 if (mask_layer_.get())
265 mask_layer_->reset_raster_scale_to_unknown(); 269 mask_layer_->reset_raster_scale_to_unknown();
266 if (replica_layer_.get() && replica_layer_->mask_layer_.get()) 270 if (replica_layer_.get() && replica_layer_->mask_layer_.get())
267 replica_layer_->mask_layer_->reset_raster_scale_to_unknown(); 271 replica_layer_->mask_layer_->reset_raster_scale_to_unknown();
268 } 272 }
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 } 979 }
976 980
977 void Layer::Set3dSortingContextId(int id) { 981 void Layer::Set3dSortingContextId(int id) {
978 DCHECK(IsPropertyChangeAllowed()); 982 DCHECK(IsPropertyChangeAllowed());
979 if (id == sorting_context_id_) 983 if (id == sorting_context_id_)
980 return; 984 return;
981 sorting_context_id_ = id; 985 sorting_context_id_ = id;
982 SetNeedsCommit(); 986 SetNeedsCommit();
983 } 987 }
984 988
989 void Layer::SetTransformTreeIndex(int index) {
990 DCHECK(IsPropertyChangeAllowed());
991 if (transform_tree_index_ == index)
992 return;
993 transform_tree_index_ = index;
994 SetNeedsPushProperties();
995 }
996
997 int Layer::transform_tree_index() const {
998 if (!layer_tree_host_ ||
999 layer_tree_host_->property_trees()->sequence_number !=
1000 property_tree_sequence_number_) {
1001 return -1;
1002 }
1003 return transform_tree_index_;
1004 }
1005
1006 void Layer::SetClipTreeIndex(int index) {
1007 DCHECK(IsPropertyChangeAllowed());
1008 if (clip_tree_index_ == index)
1009 return;
1010 clip_tree_index_ = index;
1011 SetNeedsPushProperties();
1012 }
1013
1014 int Layer::clip_tree_index() const {
1015 if (!layer_tree_host_ ||
1016 layer_tree_host_->property_trees()->sequence_number !=
1017 property_tree_sequence_number_) {
1018 return -1;
1019 }
1020 return clip_tree_index_;
1021 }
1022
1023 void Layer::SetOpacityTreeIndex(int index) {
1024 DCHECK(IsPropertyChangeAllowed());
1025 if (opacity_tree_index_ == index)
1026 return;
1027 opacity_tree_index_ = index;
1028 SetNeedsPushProperties();
1029 }
1030
1031 int Layer::opacity_tree_index() const {
1032 if (!layer_tree_host_ ||
1033 layer_tree_host_->property_trees()->sequence_number !=
1034 property_tree_sequence_number_) {
1035 return -1;
1036 }
1037 return opacity_tree_index_;
1038 }
1039
985 void Layer::SetShouldFlattenTransform(bool should_flatten) { 1040 void Layer::SetShouldFlattenTransform(bool should_flatten) {
986 DCHECK(IsPropertyChangeAllowed()); 1041 DCHECK(IsPropertyChangeAllowed());
987 if (should_flatten_transform_ == should_flatten) 1042 if (should_flatten_transform_ == should_flatten)
988 return; 1043 return;
989 should_flatten_transform_ = should_flatten; 1044 should_flatten_transform_ = should_flatten;
990 SetNeedsCommit(); 1045 SetNeedsCommit();
991 } 1046 }
992 1047
993 void Layer::SetIsDrawable(bool is_drawable) { 1048 void Layer::SetIsDrawable(bool is_drawable) {
994 DCHECK(IsPropertyChangeAllowed()); 1049 DCHECK(IsPropertyChangeAllowed());
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 layer->SetPositionConstraint(position_constraint_); 1174 layer->SetPositionConstraint(position_constraint_);
1120 layer->SetShouldFlattenTransform(should_flatten_transform_); 1175 layer->SetShouldFlattenTransform(should_flatten_transform_);
1121 layer->set_should_flatten_transform_from_property_tree( 1176 layer->set_should_flatten_transform_from_property_tree(
1122 should_flatten_transform_from_property_tree_); 1177 should_flatten_transform_from_property_tree_);
1123 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_); 1178 layer->SetUseParentBackfaceVisibility(use_parent_backface_visibility_);
1124 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating()) 1179 if (!layer->TransformIsAnimatingOnImplOnly() && !TransformIsAnimating())
1125 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_); 1180 layer->SetTransformAndInvertibility(transform_, transform_is_invertible_);
1126 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly())); 1181 DCHECK(!(TransformIsAnimating() && layer->TransformIsAnimatingOnImplOnly()));
1127 layer->Set3dSortingContextId(sorting_context_id_); 1182 layer->Set3dSortingContextId(sorting_context_id_);
1128 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_); 1183 layer->SetNumDescendantsThatDrawContent(num_descendants_that_draw_content_);
1129 layer->set_transform_tree_index(transform_tree_index_); 1184 layer->SetTransformTreeIndex(transform_tree_index());
1130 layer->set_opacity_tree_index(opacity_tree_index_); 1185 layer->SetOpacityTreeIndex(opacity_tree_index());
1131 layer->set_clip_tree_index(clip_tree_index_); 1186 layer->SetClipTreeIndex(clip_tree_index());
1132 layer->set_offset_to_transform_parent(offset_to_transform_parent_); 1187 layer->set_offset_to_transform_parent(offset_to_transform_parent_);
1133 1188
1134 layer->SetScrollClipLayer(scroll_clip_layer_id_); 1189 layer->SetScrollClipLayer(scroll_clip_layer_id_);
1135 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_); 1190 layer->set_user_scrollable_horizontal(user_scrollable_horizontal_);
1136 layer->set_user_scrollable_vertical(user_scrollable_vertical_); 1191 layer->set_user_scrollable_vertical(user_scrollable_vertical_);
1137 1192
1138 LayerImpl* scroll_parent = nullptr; 1193 LayerImpl* scroll_parent = nullptr;
1139 if (scroll_parent_) { 1194 if (scroll_parent_) {
1140 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id()); 1195 scroll_parent = layer->layer_tree_impl()->LayerById(scroll_parent_->id());
1141 DCHECK(scroll_parent); 1196 DCHECK(scroll_parent);
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
1514 1569
1515 void Layer::DidBeginTracing() { 1570 void Layer::DidBeginTracing() {
1516 // We'll be dumping layer trees as part of trace, so make sure 1571 // We'll be dumping layer trees as part of trace, so make sure
1517 // PushPropertiesTo() propagates layer debug info to the impl 1572 // PushPropertiesTo() propagates layer debug info to the impl
1518 // side -- otherwise this won't happen for the the layers that 1573 // side -- otherwise this won't happen for the the layers that
1519 // remain unchanged since tracing started. 1574 // remain unchanged since tracing started.
1520 SetNeedsPushProperties(); 1575 SetNeedsPushProperties();
1521 } 1576 }
1522 1577
1523 } // namespace cc 1578 } // namespace cc
OLDNEW
« 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