| 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 // When the memory policy is set to zero, its important to release any |
| 1285 // decoded images cached by the tracker. But we can not re-checker any |
| 1286 // images that have been displayed since the resources, if held by the |
| 1287 // browser, may be re-used. Which is why its important to maintain the |
| 1288 // decode policy tracking. |
| 1289 bool can_clear_decode_policy_tracking = false; |
| 1290 tile_manager_.ClearCheckerImageTracking(can_clear_decode_policy_tracking); |
| 1283 } | 1291 } |
| 1284 | 1292 |
| 1285 DCHECK(resource_pool_); | 1293 DCHECK(resource_pool_); |
| 1286 resource_pool_->CheckBusyResources(); | 1294 resource_pool_->CheckBusyResources(); |
| 1287 // Soft limit is used for resource pool such that memory returns to soft | 1295 // Soft limit is used for resource pool such that memory returns to soft |
| 1288 // limit after going over. | 1296 // limit after going over. |
| 1289 resource_pool_->SetResourceUsageLimits( | 1297 resource_pool_->SetResourceUsageLimits( |
| 1290 global_tile_state_.soft_memory_limit_in_bytes, | 1298 global_tile_state_.soft_memory_limit_in_bytes, |
| 1291 global_tile_state_.num_resources_limit); | 1299 global_tile_state_.num_resources_limit); |
| 1292 | 1300 |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 } | 2340 } |
| 2333 | 2341 |
| 2334 std::vector<base::Closure> | 2342 std::vector<base::Closure> |
| 2335 LayerTreeHostImpl::TakeCompletedImageDecodeCallbacks() { | 2343 LayerTreeHostImpl::TakeCompletedImageDecodeCallbacks() { |
| 2336 auto result = std::move(completed_image_decode_callbacks_); | 2344 auto result = std::move(completed_image_decode_callbacks_); |
| 2337 completed_image_decode_callbacks_.clear(); | 2345 completed_image_decode_callbacks_.clear(); |
| 2338 return result; | 2346 return result; |
| 2339 } | 2347 } |
| 2340 | 2348 |
| 2341 void LayerTreeHostImpl::ClearImageCacheOnNavigation() { | 2349 void LayerTreeHostImpl::ClearImageCacheOnNavigation() { |
| 2350 // It is safe to clear the decode policy tracking on navigations since it |
| 2351 // comes with an invalidation and the image ids are never re-used. |
| 2352 bool can_clear_decode_policy_tracking = true; |
| 2353 tile_manager_.ClearCheckerImageTracking(can_clear_decode_policy_tracking); |
| 2342 if (image_decode_cache_) | 2354 if (image_decode_cache_) |
| 2343 image_decode_cache_->ClearCache(); | 2355 image_decode_cache_->ClearCache(); |
| 2344 } | 2356 } |
| 2345 | 2357 |
| 2346 void LayerTreeHostImpl::DidChangeScrollbarVisibility() { | 2358 void LayerTreeHostImpl::DidChangeScrollbarVisibility() { |
| 2347 // Need a commit since input handling for scrollbars is handled in Blink so | 2359 // 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 | 2360 // we need to communicate to Blink when the compositor shows/hides the |
| 2349 // scrollbars. | 2361 // scrollbars. |
| 2350 client_->SetNeedsCommitOnImplThread(); | 2362 client_->SetNeedsCommitOnImplThread(); |
| 2351 } | 2363 } |
| (...skipping 1939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4291 | 4303 |
| 4292 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4304 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4293 if (!element_id) | 4305 if (!element_id) |
| 4294 return; | 4306 return; |
| 4295 if (ScrollbarAnimationController* animation_controller = | 4307 if (ScrollbarAnimationController* animation_controller = |
| 4296 ScrollbarAnimationControllerForElementId(element_id)) | 4308 ScrollbarAnimationControllerForElementId(element_id)) |
| 4297 animation_controller->DidScrollUpdate(); | 4309 animation_controller->DidScrollUpdate(); |
| 4298 } | 4310 } |
| 4299 | 4311 |
| 4300 } // namespace cc | 4312 } // namespace cc |
| OLD | NEW |