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

Side by Side Diff: cc/trees/tree_synchronizer.cc

Issue 2846653002: cc : Stop pushing layers from hidden subtrees at commit
Patch Set: . Created 3 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
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/trees/tree_synchronizer.h" 5 #include "cc/trees/tree_synchronizer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 LayerType* layer, 67 LayerType* layer,
68 LayerTreeImpl* tree_impl) { 68 LayerTreeImpl* tree_impl) {
69 if (!layer) 69 if (!layer)
70 return nullptr; 70 return nullptr;
71 std::unique_ptr<LayerImpl> layer_impl = std::move((*old_layers)[layer->id()]); 71 std::unique_ptr<LayerImpl> layer_impl = std::move((*old_layers)[layer->id()]);
72 if (!layer_impl) 72 if (!layer_impl)
73 layer_impl = layer->CreateLayerImpl(tree_impl); 73 layer_impl = layer->CreateLayerImpl(tree_impl);
74 return layer_impl; 74 return layer_impl;
75 } 75 }
76 76
77 static bool IsHidden(Layer* layer) {
78 return layer->is_hidden();
79 }
80
81 static bool IsHidden(LayerImpl* layer) {
82 return false;
83 }
84
85 static void RemoveLayerShouldPushProperties(LayerTreeHost* host, Layer* layer) {
86 host->RemoveLayerShouldPushProperties(layer);
87 }
88
89 static void RemoveLayerShouldPushProperties(LayerTreeImpl* host_impl,
90 LayerImpl* layer) {}
91
77 template <typename LayerTreeType> 92 template <typename LayerTreeType>
78 void PushLayerList(OwnedLayerImplMap* old_layers, 93 void PushLayerList(OwnedLayerImplMap* old_layers,
79 LayerTreeType* host, 94 LayerTreeType* host,
80 LayerTreeImpl* tree_impl) { 95 LayerTreeImpl* tree_impl) {
81 tree_impl->ClearLayerList(); 96 tree_impl->ClearLayerList();
82 for (auto* layer : *host) { 97 for (auto* layer : *host) {
83 std::unique_ptr<LayerImpl> layer_impl( 98 if (!IsHidden(layer)) {
84 ReuseOrCreateLayerImpl(old_layers, layer, tree_impl)); 99 std::unique_ptr<LayerImpl> layer_impl(
100 ReuseOrCreateLayerImpl(old_layers, layer, tree_impl));
85 101
86 tree_impl->AddToLayerList(layer_impl.get()); 102 tree_impl->AddToLayerList(layer_impl.get());
87 tree_impl->AddLayer(std::move(layer_impl)); 103 tree_impl->AddLayer(std::move(layer_impl));
104 } else {
105 RemoveLayerShouldPushProperties(host, layer);
106 }
88 } 107 }
89 tree_impl->OnCanDrawStateChangedForTree(); 108 tree_impl->OnCanDrawStateChangedForTree();
90 } 109 }
91 110
92 template <typename LayerType> 111 template <typename LayerType>
93 static void PushLayerPropertiesInternal( 112 static void PushLayerPropertiesInternal(
94 std::unordered_set<LayerType*> layers_that_should_push_properties, 113 std::unordered_set<LayerType*> layers_that_should_push_properties,
95 LayerTreeImpl* impl_tree) { 114 LayerTreeImpl* impl_tree) {
96 for (auto layer : layers_that_should_push_properties) { 115 for (auto layer : layers_that_should_push_properties) {
97 LayerImpl* layer_impl = impl_tree->LayerById(layer->id()); 116 LayerImpl* layer_impl = impl_tree->LayerById(layer->id());
98 DCHECK(layer_impl); 117 DCHECK(layer_impl);
99 layer->PushPropertiesTo(layer_impl); 118 layer->PushPropertiesTo(layer_impl);
100 } 119 }
101 } 120 }
102 121
103 void TreeSynchronizer::PushLayerProperties(LayerTreeImpl* pending_tree, 122 void TreeSynchronizer::PushLayerProperties(LayerTreeImpl* pending_tree,
104 LayerTreeImpl* active_tree) { 123 LayerTreeImpl* active_tree) {
105 PushLayerPropertiesInternal(pending_tree->LayersThatShouldPushProperties(), 124 PushLayerPropertiesInternal(pending_tree->LayersThatShouldPushProperties(),
106 active_tree); 125 active_tree);
107 } 126 }
108 127
109 void TreeSynchronizer::PushLayerProperties(LayerTreeHost* host_tree, 128 void TreeSynchronizer::PushLayerProperties(LayerTreeHost* host_tree,
110 LayerTreeImpl* impl_tree) { 129 LayerTreeImpl* impl_tree) {
111 PushLayerPropertiesInternal(host_tree->LayersThatShouldPushProperties(), 130 PushLayerPropertiesInternal(host_tree->LayersThatShouldPushProperties(),
112 impl_tree); 131 impl_tree);
113 } 132 }
114 133
115 } // namespace cc 134 } // namespace cc
OLDNEW
« cc/trees/layer_tree_host_common_unittest.cc ('K') | « cc/trees/property_tree_builder.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698