| Index: cc/trees/layer_tree_host.cc
|
| diff --git a/cc/trees/layer_tree_host.cc b/cc/trees/layer_tree_host.cc
|
| index 773a689ac03749590685580a88dafb9cb92fcf0b..3b9da9006ce597344079868c5d94788b7bdb78d7 100644
|
| --- a/cc/trees/layer_tree_host.cc
|
| +++ b/cc/trees/layer_tree_host.cc
|
| @@ -62,7 +62,10 @@ RendererCapabilities::RendererCapabilities()
|
| RendererCapabilities::~RendererCapabilities() {}
|
|
|
| UIResourceRequest::UIResourceRequest()
|
| - : type(UIResourceInvalidRequest), id(0), bitmap(NULL) {}
|
| + : type(UIResourceInvalidRequest),
|
| + id(0),
|
| + bitmap(NULL),
|
| + eviction_count_recreated(0) {}
|
|
|
| UIResourceRequest::~UIResourceRequest() {}
|
|
|
| @@ -86,6 +89,7 @@ static int s_next_tree_id = 1;
|
| LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
|
| const LayerTreeSettings& settings)
|
| : next_ui_resource_id_(1),
|
| + ui_resource_eviction_count_recreated_(0),
|
| animating_(false),
|
| needs_full_tree_sync_(true),
|
| needs_filter_context_(false),
|
| @@ -379,6 +383,13 @@ void LayerTreeHost::FinishCommitOnImplThread(LayerTreeHostImpl* host_impl) {
|
| overhang_ui_resource_->GetSize());
|
| }
|
|
|
| + // If all UI resource evictions will not be recreated by this commit, then
|
| + // another commit is required.
|
| + if (ui_resource_eviction_count_recreated_ !=
|
| + host_impl->ui_resource_eviction_count()) {
|
| + host_impl->SetNeedsCommit();
|
| + }
|
| +
|
| DCHECK(!sync_tree->ViewportSizeInvalid());
|
|
|
| if (new_impl_tree_has_no_evicted_resources) {
|
| @@ -444,9 +455,6 @@ void LayerTreeHost::DidLoseOutputSurface() {
|
| if (output_surface_lost_)
|
| return;
|
|
|
| - bool resource_lost = true;
|
| - RecreateUIResources(resource_lost);
|
| -
|
| num_failed_recreate_attempts_ = 0;
|
| output_surface_lost_ = true;
|
| SetNeedsCommit();
|
| @@ -1176,7 +1184,11 @@ void LayerTreeHost::DeleteUIResource(UIResourceId uid) {
|
| ui_resource_client_map_.erase(uid);
|
| }
|
|
|
| -void LayerTreeHost::RecreateUIResources(bool resource_lost) {
|
| +bool LayerTreeHost::SetUIResourceEvictionCount(
|
| + uint64 ui_resource_eviction_count) {
|
| + if (ui_resource_eviction_count_recreated_ == ui_resource_eviction_count)
|
| + return false;
|
| +
|
| for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin();
|
| iter != ui_resource_client_map_.end();
|
| ++iter) {
|
| @@ -1184,10 +1196,18 @@ void LayerTreeHost::RecreateUIResources(bool resource_lost) {
|
| UIResourceRequest request;
|
| request.type = UIResourceRequest::UIResourceCreate;
|
| request.id = uid;
|
| + bool resource_lost = true;
|
| request.bitmap = iter->second->GetBitmap(uid, resource_lost);
|
| DCHECK(request.bitmap.get());
|
| ui_resource_request_queue_.push_back(request);
|
| }
|
| + UIResourceRequest request;
|
| + request.type = UIResourceRequest::UIResourceEvictionRecreated;
|
| + request.eviction_count_recreated = ui_resource_eviction_count;
|
| + ui_resource_request_queue_.push_back(request);
|
| + ui_resource_eviction_count_recreated_ = ui_resource_eviction_count;
|
| +
|
| + return true;
|
| }
|
|
|
| } // namespace cc
|
|
|