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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 23621021: (not for review yet) (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_impl.h ('k') | cc/trees/layer_tree_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_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 03d35893936dcdc64e51266601b8393b071e6e43..8108870fc76a0f0b6777c558283124cfeeb6abdb 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -308,6 +308,13 @@ bool LayerTreeHostImpl::CanDraw() const {
TRACE_EVENT_SCOPE_THREAD);
return false;
}
+ if (active_tree_->ui_resource_eviction_count_acked() !=
+ ui_resource_eviction_count()) {
+ TRACE_EVENT_INSTANT0(
+ "cc", "LayerTreeHostImpl::CanDraw UI resources evicted",
+ TRACE_EVENT_SCOPE_THREAD);
+ return false;
+ }
return true;
}
@@ -1523,6 +1530,9 @@ void LayerTreeHostImpl::SetVisible(bool visible) {
DidVisibilityChange(this, visible_);
EnforceManagedMemoryPolicy(ActualManagedMemoryPolicy());
+ if (!visible_)
+ DeleteAllUIResources();
+
// Evict tiles immediately if invisible since this tab may never get another
// draw or timer tick.
if (!visible_)
@@ -2575,12 +2585,20 @@ void LayerTreeHostImpl::DeleteUIResource(UIResourceId uid) {
}
void LayerTreeHostImpl::DeleteAllUIResources() {
+ if (ui_resource_map_.empty())
+ return;
+
for (UIResourceMap::const_iterator iter = ui_resource_map_.begin();
iter != ui_resource_map_.end();
++iter) {
resource_provider_->DeleteResource(iter->second);
}
ui_resource_map_.clear();
+
+ ui_resource_eviction_count_ += 1;
+ client_->SetNeedsCommitOnImplThread();
+ client_->OnCanDrawStateChanged(CanDraw());
+ client_->RenewTreePriority();
}
ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource(
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698