| 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(
|
|
|