OLD | NEW |
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 allow_partial_texture_updates(false), | 54 allow_partial_texture_updates(false), |
55 using_offscreen_context3d(false), | 55 using_offscreen_context3d(false), |
56 max_texture_size(0), | 56 max_texture_size(0), |
57 avoid_pow2_textures(false), | 57 avoid_pow2_textures(false), |
58 using_map_image(false), | 58 using_map_image(false), |
59 using_shared_memory_resources(false) {} | 59 using_shared_memory_resources(false) {} |
60 | 60 |
61 RendererCapabilities::~RendererCapabilities() {} | 61 RendererCapabilities::~RendererCapabilities() {} |
62 | 62 |
63 UIResourceRequest::UIResourceRequest() | 63 UIResourceRequest::UIResourceRequest() |
64 : type(UIResourceInvalidRequest), id(0), bitmap(NULL) {} | 64 : type(UIResourceInvalidRequest), id(0), bitmap(NULL), ack(0) {} |
65 | 65 |
66 UIResourceRequest::~UIResourceRequest() {} | 66 UIResourceRequest::~UIResourceRequest() {} |
67 | 67 |
68 bool LayerTreeHost::AnyLayerTreeHostInstanceExists() { | 68 bool LayerTreeHost::AnyLayerTreeHostInstanceExists() { |
69 return s_num_layer_tree_instances > 0; | 69 return s_num_layer_tree_instances > 0; |
70 } | 70 } |
71 | 71 |
72 scoped_ptr<LayerTreeHost> LayerTreeHost::Create( | 72 scoped_ptr<LayerTreeHost> LayerTreeHost::Create( |
73 LayerTreeHostClient* client, | 73 LayerTreeHostClient* client, |
74 const LayerTreeSettings& settings, | 74 const LayerTreeSettings& settings, |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 | 363 |
364 if (!ui_resource_request_queue_.empty()) { | 364 if (!ui_resource_request_queue_.empty()) { |
365 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); | 365 sync_tree->set_ui_resource_request_queue(ui_resource_request_queue_); |
366 ui_resource_request_queue_.clear(); | 366 ui_resource_request_queue_.clear(); |
367 // Process any ui resource requests in the queue. For impl-side-painting, | 367 // Process any ui resource requests in the queue. For impl-side-painting, |
368 // the queue is processed in LayerTreeHostImpl::ActivatePendingTree. | 368 // the queue is processed in LayerTreeHostImpl::ActivatePendingTree. |
369 if (!settings_.impl_side_painting) | 369 if (!settings_.impl_side_painting) |
370 sync_tree->ProcessUIResourceRequestQueue(); | 370 sync_tree->ProcessUIResourceRequestQueue(); |
371 } | 371 } |
372 | 372 |
| 373 // If all UI resource evictions will not be acknowledged by this commit, then |
| 374 // another commit is required. |
| 375 if (ui_resource_eviction_count_last_acked_ != |
| 376 host_impl->ui_resource_eviction_count()) { |
| 377 host_impl->SetNeedsCommit(); |
| 378 } |
| 379 |
373 DCHECK(!sync_tree->ViewportSizeInvalid()); | 380 DCHECK(!sync_tree->ViewportSizeInvalid()); |
374 | 381 |
375 if (new_impl_tree_has_no_evicted_resources) { | 382 if (new_impl_tree_has_no_evicted_resources) { |
376 if (sync_tree->ContentsTexturesPurged()) | 383 if (sync_tree->ContentsTexturesPurged()) |
377 sync_tree->ResetContentsTexturesPurged(); | 384 sync_tree->ResetContentsTexturesPurged(); |
378 } | 385 } |
379 | 386 |
380 if (!settings_.impl_side_painting) { | 387 if (!settings_.impl_side_painting) { |
381 // If we're not in impl-side painting, the tree is immediately | 388 // If we're not in impl-side painting, the tree is immediately |
382 // considered active. | 389 // considered active. |
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 UIResourceId uid = iter->first; | 1165 UIResourceId uid = iter->first; |
1159 UIResourceRequest request; | 1166 UIResourceRequest request; |
1160 request.type = UIResourceRequest::UIResourceCreate; | 1167 request.type = UIResourceRequest::UIResourceCreate; |
1161 request.id = uid; | 1168 request.id = uid; |
1162 request.bitmap = iter->second->GetBitmap(uid, resource_lost); | 1169 request.bitmap = iter->second->GetBitmap(uid, resource_lost); |
1163 DCHECK(request.bitmap.get()); | 1170 DCHECK(request.bitmap.get()); |
1164 ui_resource_request_queue_.push_back(request); | 1171 ui_resource_request_queue_.push_back(request); |
1165 } | 1172 } |
1166 } | 1173 } |
1167 | 1174 |
| 1175 void LayerTreeHost::SetUIResourceEvictionCountToAck(uint64 ui_resource_eviction_
count) { |
| 1176 if (ui_resource_eviction_count_last_acked_ == ui_resource_eviction_count) |
| 1177 return; |
| 1178 |
| 1179 bool resource_lost = false; |
| 1180 RecreateUIResources(resource_lost); |
| 1181 |
| 1182 UIResourceRequest request; |
| 1183 request.type = UIResourceRequest::UIResourceEvictionAck; |
| 1184 request.ack = ui_resource_eviction_count; |
| 1185 ui_resource_request_queue_.push_back(request); |
| 1186 ui_resource_eviction_count_last_acked_ = ui_resource_eviction_count; |
| 1187 } |
| 1188 |
1168 } // namespace cc | 1189 } // namespace cc |
OLD | NEW |