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

Unified Diff: cc/trees/layer_tree_impl.cc

Issue 899313003: cc: Split ReleaseResources into Release and Recreate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_impl.h ('k') | no next file » | 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 97ebb009ecbd7058f0fc321295fb2aec5c006011..80ccf14d7ba303bdda932fea2d83e842240bfc25 100644
--- a/cc/trees/layer_tree_impl.cc
+++ b/cc/trees/layer_tree_impl.cc
@@ -122,7 +122,12 @@ void LayerTreeImpl::Shutdown() {
void LayerTreeImpl::ReleaseResources() {
if (root_layer_)
- ReleaseResourcesRecursive(root_layer_.get());
+ ProcessLayersRecursive(root_layer_.get(), &LayerImpl::ReleaseResources);
+}
+
+void LayerTreeImpl::RecreateResources() {
+ if (root_layer_)
+ ProcessLayersRecursive(root_layer_.get(), &LayerImpl::RecreateResources);
}
void LayerTreeImpl::SetRootLayer(scoped_ptr<LayerImpl> layer) {
@@ -1159,15 +1164,16 @@ const std::vector<LayerImpl*>& LayerTreeImpl::LayersWithCopyOutputRequest()
return layers_with_copy_output_request_;
}
-void LayerTreeImpl::ReleaseResourcesRecursive(LayerImpl* current) {
+void LayerTreeImpl::ProcessLayersRecursive(LayerImpl* current,
+ void (LayerImpl::*function)()) {
DCHECK(current);
- current->ReleaseResources();
+ (current->*function)();
if (current->mask_layer())
- ReleaseResourcesRecursive(current->mask_layer());
+ ProcessLayersRecursive(current->mask_layer(), function);
if (current->replica_layer())
- ReleaseResourcesRecursive(current->replica_layer());
+ ProcessLayersRecursive(current->replica_layer(), function);
for (size_t i = 0; i < current->children().size(); ++i)
- ReleaseResourcesRecursive(current->children()[i]);
+ ProcessLayersRecursive(current->children()[i], function);
}
template <typename LayerType>
« cc/trees/layer_tree_host_impl.cc ('K') | « cc/trees/layer_tree_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698