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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 2017263002: cc: Move copy requests from layers to the effect tree (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix typo in comment Created 4 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/trees/layer_tree_impl.h ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_impl.cc
diff --git a/cc/trees/layer_tree_impl.cc b/cc/trees/layer_tree_impl.cc
index e8291ae66391837468c1a272b2f67ba66d8bb6b7..27540d1263f03e008dba25fcdcd53d489582a2c1 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -93,7 +93,6 @@ LayerTreeImpl::~LayerTreeImpl() {
// Need to explicitly clear the tree prior to destroying this so that
// the LayerTreeImpl pointer is still valid in the LayerImpl dtor.
DCHECK(!root_layer_);
- DCHECK(layers_with_copy_output_request_.empty());
}
void LayerTreeImpl::Shutdown() {
@@ -330,6 +329,19 @@ static void UpdateClipTreeForBoundsDeltaOnLayer(LayerImpl* layer,
}
}
+void LayerTreeImpl::SetPropertyTrees(PropertyTrees* property_trees) {
+ property_trees_ = *property_trees;
+ property_trees->effect_tree.PushCopyRequestsTo(&property_trees_.effect_tree);
+ property_trees_.is_main_thread = false;
+ property_trees_.is_active = IsActiveTree();
+ property_trees_.transform_tree.set_source_to_parent_updates_allowed(false);
+ // The value of some effect node properties (like is_drawn) depends on
+ // whether we are on the active tree or not. So, we need to update the
+ // effect tree.
+ if (IsActiveTree())
+ property_trees_.effect_tree.set_needs_update(true);
+}
+
void LayerTreeImpl::UpdatePropertyTreesForBoundsDelta() {
DCHECK(IsActiveTree());
LayerImpl* inner_container = InnerViewportContainerLayer();
@@ -359,7 +371,7 @@ void LayerTreeImpl::PushPropertiesTo(LayerTreeImpl* target_tree) {
DCHECK_EQ(ui_resource_request_queue_.size(), 0u);
LayerImpl* layer = target_tree->CurrentlyScrollingLayer();
- target_tree->SetPropertyTrees(property_trees_);
+ target_tree->SetPropertyTrees(&property_trees_);
target_tree->SetCurrentlyScrollingLayer(layer);
target_tree->UpdatePropertyTreeScrollOffset(&property_trees_);
@@ -777,33 +789,7 @@ void LayerTreeImpl::ClearViewportLayers() {
outer_viewport_scroll_layer_id_ = Layer::INVALID_ID;
}
-#if DCHECK_IS_ON()
-void SanityCheckCopyRequestCounts(LayerTreeImpl* layer_tree_impl) {
- EffectTree& effect_tree = layer_tree_impl->property_trees()->effect_tree;
- const int effect_tree_size = static_cast<int>(effect_tree.size());
- std::vector<int> copy_requests_count_in_effect_tree(effect_tree_size);
- for (auto* layer : *layer_tree_impl) {
- if (layer->HasCopyRequest()) {
- copy_requests_count_in_effect_tree[layer->effect_tree_index()]++;
- }
- }
- for (int i = effect_tree_size - 1; i >= 0; i--) {
- EffectNode* node = effect_tree.Node(i);
- DCHECK_EQ(node->data.num_copy_requests_in_subtree,
- copy_requests_count_in_effect_tree[i]);
- if (node->parent_id >= 0)
- copy_requests_count_in_effect_tree[node->parent_id] +=
- copy_requests_count_in_effect_tree[i];
- }
-}
-#endif
-
bool LayerTreeImpl::UpdateDrawProperties(bool update_lcd_text) {
-#if DCHECK_IS_ON()
- if (root_layer())
- SanityCheckCopyRequestCounts(root_layer()->layer_tree_impl());
-#endif
-
if (!needs_update_draw_properties_)
return true;
@@ -1488,40 +1474,6 @@ void LayerTreeImpl::UnregisterScrollLayer(LayerImpl* layer) {
clip_scroll_map_.erase(layer->scroll_clip_layer_id());
}
-void LayerTreeImpl::AddLayerWithCopyOutputRequest(LayerImpl* layer) {
- // Only the active tree needs to know about layers with copy requests, as
- // they are aborted if not serviced during draw.
- DCHECK(IsActiveTree());
-
- // DCHECK(std::find(layers_with_copy_output_request_.begin(),
- // layers_with_copy_output_request_.end(),
- // layer) == layers_with_copy_output_request_.end());
- // TODO(danakj): Remove this once crash is found crbug.com/309777
- for (size_t i = 0; i < layers_with_copy_output_request_.size(); ++i) {
- CHECK(layers_with_copy_output_request_[i] != layer)
- << i << " of " << layers_with_copy_output_request_.size();
- }
- layers_with_copy_output_request_.push_back(layer);
-}
-
-void LayerTreeImpl::RemoveLayerWithCopyOutputRequest(LayerImpl* layer) {
- // Only the active tree needs to know about layers with copy requests, as
- // they are aborted if not serviced during draw.
- DCHECK(IsActiveTree());
-
- std::vector<LayerImpl*>::iterator it =
- std::find(layers_with_copy_output_request_.begin(),
- layers_with_copy_output_request_.end(), layer);
- DCHECK(it != layers_with_copy_output_request_.end());
- layers_with_copy_output_request_.erase(it);
-
- // TODO(danakj): Remove this once crash is found crbug.com/309777
- for (size_t i = 0; i < layers_with_copy_output_request_.size(); ++i) {
- CHECK(layers_with_copy_output_request_[i] != layer)
- << i << " of " << layers_with_copy_output_request_.size();
- }
-}
-
void LayerTreeImpl::AddSurfaceLayer(LayerImpl* layer) {
DCHECK(std::find(surface_layers_.begin(), surface_layers_.end(), layer) ==
surface_layers_.end());
@@ -1535,15 +1487,6 @@ void LayerTreeImpl::RemoveSurfaceLayer(LayerImpl* layer) {
surface_layers_.erase(it);
}
-const std::vector<LayerImpl*>& LayerTreeImpl::LayersWithCopyOutputRequest()
- const {
- // Only the active tree needs to know about layers with copy requests, as
- // they are aborted if not serviced during draw.
- DCHECK(IsActiveTree());
-
- return layers_with_copy_output_request_;
-}
-
template <typename LayerType>
static inline bool LayerClipsSubtree(LayerType* layer) {
return layer->masks_to_bounds() || layer->mask_layer();
« no previous file with comments | « cc/trees/layer_tree_impl.h ('k') | cc/trees/occlusion_tracker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698