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

Unified Diff: cc/trees/layer_tree_host.cc

Issue 23475021: [cc] Consolidate UI resource destruction and recreation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host.cc
diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
index 27659e054bea869e8bcc1940036e2f5d82fead9b..220083f77f30b11cc53a38d723df0856f2da10b1 100644
--- a/cc/trees/layer_tree_host.cc
+++ b/cc/trees/layer_tree_host.cc
@@ -435,7 +435,8 @@ void LayerTreeHost::DidLoseOutputSurface() {
if (output_surface_lost_)
return;
- DidLoseUIResources();
+ bool resource_lost = true;
+ RecreateUIResources(resource_lost);
num_failed_recreate_attempts_ = 0;
output_surface_lost_ = true;
@@ -1150,26 +1151,17 @@ void LayerTreeHost::DeleteUIResource(UIResourceId uid) {
ui_resource_client_map_.erase(uid);
}
-void LayerTreeHost::UIResourceLost(UIResourceId uid) {
- UIResourceClientMap::iterator iter = ui_resource_client_map_.find(uid);
- if (iter == ui_resource_client_map_.end())
- return;
-
- UIResourceRequest request;
- bool resource_lost = true;
- request.type = UIResourceRequest::UIResourceCreate;
- request.id = uid;
- request.bitmap = iter->second->GetBitmap(uid, resource_lost);
- DCHECK(request.bitmap.get());
- ui_resource_request_queue_.push_back(request);
-}
-
-void LayerTreeHost::DidLoseUIResources() {
- // When output surface is lost, we need to recreate the resource.
+void LayerTreeHost::RecreateUIResources(bool resource_lost) {
for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
iter != ui_resource_client_map_.end();
++iter) {
- UIResourceLost(iter->first);
+ UIResourceId uid = iter->first;
+ UIResourceRequest request;
+ request.type = UIResourceRequest::UIResourceCreate;
+ request.id = uid;
+ request.bitmap = iter->second->GetBitmap(uid, resource_lost);
+ DCHECK(request.bitmap.get());
+ ui_resource_request_queue_.push_back(request);
}
}
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698