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

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

Issue 23548022: [cc] Evict UIResources when the renderer is not visible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 return host_impl.Pass(); 437 return host_impl.Pass();
438 } 438 }
439 439
440 void LayerTreeHost::DidLoseOutputSurface() { 440 void LayerTreeHost::DidLoseOutputSurface() {
441 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface"); 441 TRACE_EVENT0("cc", "LayerTreeHost::DidLoseOutputSurface");
442 DCHECK(proxy_->IsMainThread()); 442 DCHECK(proxy_->IsMainThread());
443 443
444 if (output_surface_lost_) 444 if (output_surface_lost_)
445 return; 445 return;
446 446
447 bool resource_lost = true;
448 RecreateUIResources(resource_lost);
449
450 num_failed_recreate_attempts_ = 0; 447 num_failed_recreate_attempts_ = 0;
451 output_surface_lost_ = true; 448 output_surface_lost_ = true;
452 SetNeedsCommit(); 449 SetNeedsCommit();
453 } 450 }
454 451
455 bool LayerTreeHost::CompositeAndReadback(void* pixels, 452 bool LayerTreeHost::CompositeAndReadback(void* pixels,
456 gfx::Rect rect_in_device_viewport) { 453 gfx::Rect rect_in_device_viewport) {
457 trigger_idle_updates_ = false; 454 trigger_idle_updates_ = false;
458 bool ret = proxy_->CompositeAndReadback(pixels, rect_in_device_viewport); 455 bool ret = proxy_->CompositeAndReadback(pixels, rect_in_device_viewport);
459 trigger_idle_updates_ = true; 456 trigger_idle_updates_ = true;
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 if (iter == ui_resource_client_map_.end()) 1166 if (iter == ui_resource_client_map_.end())
1170 return; 1167 return;
1171 1168
1172 UIResourceRequest request; 1169 UIResourceRequest request;
1173 request.type = UIResourceRequest::UIResourceDelete; 1170 request.type = UIResourceRequest::UIResourceDelete;
1174 request.id = uid; 1171 request.id = uid;
1175 ui_resource_request_queue_.push_back(request); 1172 ui_resource_request_queue_.push_back(request);
1176 ui_resource_client_map_.erase(uid); 1173 ui_resource_client_map_.erase(uid);
1177 } 1174 }
1178 1175
1179 void LayerTreeHost::RecreateUIResources(bool resource_lost) { 1176 void LayerTreeHost::RecreateUIResources() {
1180 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); 1177 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
1181 iter != ui_resource_client_map_.end(); 1178 iter != ui_resource_client_map_.end();
1182 ++iter) { 1179 ++iter) {
1183 UIResourceId uid = iter->first; 1180 UIResourceId uid = iter->first;
1184 UIResourceRequest request; 1181 UIResourceRequest request;
1185 request.type = UIResourceRequest::UIResourceCreate; 1182 request.type = UIResourceRequest::UIResourceCreate;
1186 request.id = uid; 1183 request.id = uid;
1184 bool resource_lost = true;
1187 request.bitmap = iter->second->GetBitmap(uid, resource_lost); 1185 request.bitmap = iter->second->GetBitmap(uid, resource_lost);
1188 DCHECK(request.bitmap.get()); 1186 DCHECK(request.bitmap.get());
1189 ui_resource_request_queue_.push_back(request); 1187 ui_resource_request_queue_.push_back(request);
1190 } 1188 }
1191 } 1189 }
1192 1190
1193 } // namespace cc 1191 } // namespace cc
OLDNEW
« 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