Chromium Code Reviews| 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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1273 // becoming invisible in NotifyAllTileTasksComplete to avoid interrupting | 1273 // becoming invisible in NotifyAllTileTasksComplete to avoid interrupting |
| 1274 // running work. | 1274 // running work. |
| 1275 SetContextVisibility(true); | 1275 SetContextVisibility(true); |
| 1276 | 1276 |
| 1277 // If |global_tile_state_.hard_memory_limit_in_bytes| is greater than 0, we | 1277 // If |global_tile_state_.hard_memory_limit_in_bytes| is greater than 0, we |
| 1278 // allow the image decode controller to retain resources. We handle the | 1278 // allow the image decode controller to retain resources. We handle the |
| 1279 // equal to 0 case in NotifyAllTileTasksComplete to avoid interrupting | 1279 // equal to 0 case in NotifyAllTileTasksComplete to avoid interrupting |
| 1280 // running work. | 1280 // running work. |
| 1281 if (image_decode_cache_) | 1281 if (image_decode_cache_) |
| 1282 image_decode_cache_->SetShouldAggressivelyFreeResources(false); | 1282 image_decode_cache_->SetShouldAggressivelyFreeResources(false); |
| 1283 } else { | |
| 1284 // Clear checkered image state so we unlock cached images. Since we will be | |
| 1285 // evicting all tile resources and images from the ImageDecodeCache, this | |
| 1286 // also ensures that we re-checker these images. | |
| 1287 tile_manager_.ClearCheckerImageTracking(); | |
|
vmpstr
2017/05/09 22:06:21
Can you verify what happens in a resourceless soft
Khushal
2017/05/10 00:53:17
Do you think this is okay for the general case? In
| |
| 1283 } | 1288 } |
| 1284 | 1289 |
| 1285 DCHECK(resource_pool_); | 1290 DCHECK(resource_pool_); |
| 1286 resource_pool_->CheckBusyResources(); | 1291 resource_pool_->CheckBusyResources(); |
| 1287 // Soft limit is used for resource pool such that memory returns to soft | 1292 // Soft limit is used for resource pool such that memory returns to soft |
| 1288 // limit after going over. | 1293 // limit after going over. |
| 1289 resource_pool_->SetResourceUsageLimits( | 1294 resource_pool_->SetResourceUsageLimits( |
| 1290 global_tile_state_.soft_memory_limit_in_bytes, | 1295 global_tile_state_.soft_memory_limit_in_bytes, |
| 1291 global_tile_state_.num_resources_limit); | 1296 global_tile_state_.num_resources_limit); |
| 1292 | 1297 |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2332 } | 2337 } |
| 2333 | 2338 |
| 2334 std::vector<base::Closure> | 2339 std::vector<base::Closure> |
| 2335 LayerTreeHostImpl::TakeCompletedImageDecodeCallbacks() { | 2340 LayerTreeHostImpl::TakeCompletedImageDecodeCallbacks() { |
| 2336 auto result = std::move(completed_image_decode_callbacks_); | 2341 auto result = std::move(completed_image_decode_callbacks_); |
| 2337 completed_image_decode_callbacks_.clear(); | 2342 completed_image_decode_callbacks_.clear(); |
| 2338 return result; | 2343 return result; |
| 2339 } | 2344 } |
| 2340 | 2345 |
| 2341 void LayerTreeHostImpl::ClearImageCacheOnNavigation() { | 2346 void LayerTreeHostImpl::ClearImageCacheOnNavigation() { |
| 2347 tile_manager_.ClearCheckerImageTracking(); | |
| 2342 if (image_decode_cache_) | 2348 if (image_decode_cache_) |
| 2343 image_decode_cache_->ClearCache(); | 2349 image_decode_cache_->ClearCache(); |
| 2344 } | 2350 } |
| 2345 | 2351 |
| 2346 void LayerTreeHostImpl::DidChangeScrollbarVisibility() { | 2352 void LayerTreeHostImpl::DidChangeScrollbarVisibility() { |
| 2347 // Need a commit since input handling for scrollbars is handled in Blink so | 2353 // Need a commit since input handling for scrollbars is handled in Blink so |
| 2348 // we need to communicate to Blink when the compositor shows/hides the | 2354 // we need to communicate to Blink when the compositor shows/hides the |
| 2349 // scrollbars. | 2355 // scrollbars. |
| 2350 client_->SetNeedsCommitOnImplThread(); | 2356 client_->SetNeedsCommitOnImplThread(); |
| 2351 } | 2357 } |
| (...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4291 | 4297 |
| 4292 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4298 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4293 if (!element_id) | 4299 if (!element_id) |
| 4294 return; | 4300 return; |
| 4295 if (ScrollbarAnimationController* animation_controller = | 4301 if (ScrollbarAnimationController* animation_controller = |
| 4296 ScrollbarAnimationControllerForElementId(element_id)) | 4302 ScrollbarAnimationControllerForElementId(element_id)) |
| 4297 animation_controller->DidScrollUpdate(); | 4303 animation_controller->DidScrollUpdate(); |
| 4298 } | 4304 } |
| 4299 | 4305 |
| 4300 } // namespace cc | 4306 } // namespace cc |
| OLD | NEW |