| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/tiles/software_image_decode_controller.h" | 5 #include "cc/tiles/software_image_decode_controller.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <functional> | 9 #include <functional> |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 // used to inform the caller of the amount of space available in the cache. The | 23 // used to inform the caller of the amount of space available in the cache. The |
| 24 // caller can still request tasks which can cause this limit to be breached. | 24 // caller can still request tasks which can cause this limit to be breached. |
| 25 const size_t kLockedMemoryLimitBytes = 128 * 1024 * 1024; | 25 const size_t kLockedMemoryLimitBytes = 128 * 1024 * 1024; |
| 26 | 26 |
| 27 // The largest single high quality image to try and process. Images above this | 27 // The largest single high quality image to try and process. Images above this |
| 28 // size will drop down to medium quality. | 28 // size will drop down to medium quality. |
| 29 const size_t kMaxHighQualityImageSizeBytes = 64 * 1024 * 1024; | 29 const size_t kMaxHighQualityImageSizeBytes = 64 * 1024 * 1024; |
| 30 | 30 |
| 31 // The number of entries to keep around in the cache. This limit can be breached | 31 // The number of entries to keep around in the cache. This limit can be breached |
| 32 // if more items are locked. That is, locked items ignore this limit. | 32 // if more items are locked. That is, locked items ignore this limit. |
| 33 const size_t kMaxItemsInCache = 100; | 33 const size_t kMaxItemsInCache = 1000; |
| 34 | 34 |
| 35 class AutoRemoveKeyFromTaskMap { | 35 class AutoRemoveKeyFromTaskMap { |
| 36 public: | 36 public: |
| 37 AutoRemoveKeyFromTaskMap( | 37 AutoRemoveKeyFromTaskMap( |
| 38 std::unordered_map<SoftwareImageDecodeController::ImageKey, | 38 std::unordered_map<SoftwareImageDecodeController::ImageKey, |
| 39 scoped_refptr<ImageDecodeTask>, | 39 scoped_refptr<ImageDecodeTask>, |
| 40 SoftwareImageDecodeController::ImageKeyHash>* task_map, | 40 SoftwareImageDecodeController::ImageKeyHash>* task_map, |
| 41 const SoftwareImageDecodeController::ImageKey& key) | 41 const SoftwareImageDecodeController::ImageKey& key) |
| 42 : task_map_(task_map), key_(key) {} | 42 : task_map_(task_map), key_(key) {} |
| 43 ~AutoRemoveKeyFromTaskMap() { task_map_->erase(key_); } | 43 ~AutoRemoveKeyFromTaskMap() { task_map_->erase(key_); } |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 void SoftwareImageDecodeController::MemoryBudget::ResetUsage() { | 890 void SoftwareImageDecodeController::MemoryBudget::ResetUsage() { |
| 891 current_usage_bytes_ = 0; | 891 current_usage_bytes_ = 0; |
| 892 } | 892 } |
| 893 | 893 |
| 894 size_t SoftwareImageDecodeController::MemoryBudget::GetCurrentUsageSafe() | 894 size_t SoftwareImageDecodeController::MemoryBudget::GetCurrentUsageSafe() |
| 895 const { | 895 const { |
| 896 return current_usage_bytes_.ValueOrDie(); | 896 return current_usage_bytes_.ValueOrDie(); |
| 897 } | 897 } |
| 898 | 898 |
| 899 } // namespace cc | 899 } // namespace cc |
| OLD | NEW |