Chromium Code Reviews| 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 08e4ac16366b7a4e3b1de129cd5b81d1c7a994d1..d6bebf57d3aee896ec46a59f346844b3e9d8bb47 100644 |
| --- a/cc/trees/layer_tree_host_impl.cc |
| +++ b/cc/trees/layer_tree_host_impl.cc |
| @@ -201,7 +201,8 @@ LayerTreeHostImpl::LayerTreeHostImpl( |
| external_stencil_test_enabled_(false), |
| animation_registrar_(AnimationRegistrar::Create()), |
| rendering_stats_instrumentation_(rendering_stats_instrumentation), |
| - need_to_update_visible_tiles_before_draw_(false) { |
| + need_to_update_visible_tiles_before_draw_(false), |
| + ui_resource_eviction_count_(0) { |
| DCHECK(proxy_->IsImplThread()); |
| DidVisibilityChange(this, visible_); |
| @@ -311,6 +312,13 @@ bool LayerTreeHostImpl::CanDraw() const { |
| TRACE_EVENT_SCOPE_THREAD); |
| return false; |
| } |
| + if (active_tree_->ui_resource_eviction_count_recreated() != |
| + ui_resource_eviction_count()) { |
| + TRACE_EVENT_INSTANT0( |
| + "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", |
| + TRACE_EVENT_SCOPE_THREAD); |
| + return false; |
| + } |
| return true; |
| } |
| @@ -1558,6 +1566,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_) |
| @@ -2639,12 +2650,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(); |
|
powei
2013/09/09 20:34:25
Maybe a stupid question, but what's the purpose of
ccameron
2013/09/09 21:01:16
Oops! I needed to update RenewTreePriority to "pre
|
| } |
| ResourceProvider::ResourceId LayerTreeHostImpl::ResourceIdForUIResource( |