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

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

Issue 1217883002: Rebuild PropertyTrees When Layer Attach to New LayerTreeHost (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2403
Patch Set: Created 5 years, 5 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 } 117 }
118 } 118 }
119 119
120 void Layer::SetLayerTreeHost(LayerTreeHost* host) { 120 void Layer::SetLayerTreeHost(LayerTreeHost* host) {
121 if (layer_tree_host_ == host) 121 if (layer_tree_host_ == host)
122 return; 122 return;
123 123
124 if (layer_tree_host_) 124 if (layer_tree_host_)
125 layer_tree_host_->property_trees()->needs_rebuild = true; 125 layer_tree_host_->property_trees()->needs_rebuild = true;
126 126
127 if (host)
128 host->property_trees()->needs_rebuild = true;
129
130 InvalidatePropertyTreesIndices();
131
127 layer_tree_host_ = host; 132 layer_tree_host_ = host;
128 133
129 // When changing hosts, the layer needs to commit its properties to the impl 134 // When changing hosts, the layer needs to commit its properties to the impl
130 // side for the new host. 135 // side for the new host.
131 SetNeedsPushProperties(); 136 SetNeedsPushProperties();
132 137
133 for (size_t i = 0; i < children_.size(); ++i) 138 for (size_t i = 0; i < children_.size(); ++i)
134 children_[i]->SetLayerTreeHost(host); 139 children_[i]->SetLayerTreeHost(host);
135 140
136 if (mask_layer_.get()) 141 if (mask_layer_.get())
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 1037
1033 int Layer::opacity_tree_index() const { 1038 int Layer::opacity_tree_index() const {
1034 if (!layer_tree_host_ || 1039 if (!layer_tree_host_ ||
1035 layer_tree_host_->property_trees()->sequence_number != 1040 layer_tree_host_->property_trees()->sequence_number !=
1036 property_tree_sequence_number_) { 1041 property_tree_sequence_number_) {
1037 return -1; 1042 return -1;
1038 } 1043 }
1039 return opacity_tree_index_; 1044 return opacity_tree_index_;
1040 } 1045 }
1041 1046
1047 void Layer::InvalidatePropertyTreesIndices() {
1048 int invalid_property_tree_index = -1;
1049 SetTransformTreeIndex(invalid_property_tree_index);
1050 SetClipTreeIndex(invalid_property_tree_index);
1051 SetOpacityTreeIndex(invalid_property_tree_index);
1052 }
1053
1042 void Layer::SetShouldFlattenTransform(bool should_flatten) { 1054 void Layer::SetShouldFlattenTransform(bool should_flatten) {
1043 DCHECK(IsPropertyChangeAllowed()); 1055 DCHECK(IsPropertyChangeAllowed());
1044 if (should_flatten_transform_ == should_flatten) 1056 if (should_flatten_transform_ == should_flatten)
1045 return; 1057 return;
1046 should_flatten_transform_ = should_flatten; 1058 should_flatten_transform_ = should_flatten;
1047 SetNeedsCommit(); 1059 SetNeedsCommit();
1048 } 1060 }
1049 1061
1050 void Layer::SetIsDrawable(bool is_drawable) { 1062 void Layer::SetIsDrawable(bool is_drawable) {
1051 DCHECK(IsPropertyChangeAllowed()); 1063 DCHECK(IsPropertyChangeAllowed());
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 1583
1572 void Layer::DidBeginTracing() { 1584 void Layer::DidBeginTracing() {
1573 // We'll be dumping layer trees as part of trace, so make sure 1585 // We'll be dumping layer trees as part of trace, so make sure
1574 // PushPropertiesTo() propagates layer debug info to the impl 1586 // PushPropertiesTo() propagates layer debug info to the impl
1575 // side -- otherwise this won't happen for the the layers that 1587 // side -- otherwise this won't happen for the the layers that
1576 // remain unchanged since tracing started. 1588 // remain unchanged since tracing started.
1577 SetNeedsPushProperties(); 1589 SetNeedsPushProperties();
1578 } 1590 }
1579 1591
1580 } // namespace cc 1592 } // 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