| 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_cache.h" | 5 #include "cc/tiles/software_image_decode_cache.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 void SoftwareImageDecodeCache::ReduceCacheUsage() { | 832 void SoftwareImageDecodeCache::ReduceCacheUsage() { |
| 833 base::AutoLock lock(lock_); | 833 base::AutoLock lock(lock_); |
| 834 ReduceCacheUsageUntilWithinLimit(max_items_in_cache_); | 834 ReduceCacheUsageUntilWithinLimit(max_items_in_cache_); |
| 835 } | 835 } |
| 836 | 836 |
| 837 void SoftwareImageDecodeCache::ClearCache() { | 837 void SoftwareImageDecodeCache::ClearCache() { |
| 838 base::AutoLock lock(lock_); | 838 base::AutoLock lock(lock_); |
| 839 ReduceCacheUsageUntilWithinLimit(0); | 839 ReduceCacheUsageUntilWithinLimit(0); |
| 840 } | 840 } |
| 841 | 841 |
| 842 size_t SoftwareImageDecodeCache::GetMaximumMemoryLimit() const { |
| 843 return locked_images_budget_.total_limit_bytes(); |
| 844 } |
| 845 |
| 842 void SoftwareImageDecodeCache::RemovePendingTask(const ImageKey& key, | 846 void SoftwareImageDecodeCache::RemovePendingTask(const ImageKey& key, |
| 843 DecodeTaskType task_type) { | 847 DecodeTaskType task_type) { |
| 844 base::AutoLock lock(lock_); | 848 base::AutoLock lock(lock_); |
| 845 switch (task_type) { | 849 switch (task_type) { |
| 846 case DecodeTaskType::USE_IN_RASTER_TASKS: | 850 case DecodeTaskType::USE_IN_RASTER_TASKS: |
| 847 pending_in_raster_image_tasks_.erase(key); | 851 pending_in_raster_image_tasks_.erase(key); |
| 848 break; | 852 break; |
| 849 case DecodeTaskType::USE_OUT_OF_RASTER_TASKS: | 853 case DecodeTaskType::USE_OUT_OF_RASTER_TASKS: |
| 850 pending_out_of_raster_image_tasks_.erase(key); | 854 pending_out_of_raster_image_tasks_.erase(key); |
| 851 break; | 855 break; |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1173 } | 1177 } |
| 1174 } | 1178 } |
| 1175 } | 1179 } |
| 1176 | 1180 |
| 1177 void SoftwareImageDecodeCache::OnPurgeMemory() { | 1181 void SoftwareImageDecodeCache::OnPurgeMemory() { |
| 1178 base::AutoLock lock(lock_); | 1182 base::AutoLock lock(lock_); |
| 1179 ReduceCacheUsageUntilWithinLimit(0); | 1183 ReduceCacheUsageUntilWithinLimit(0); |
| 1180 } | 1184 } |
| 1181 | 1185 |
| 1182 } // namespace cc | 1186 } // namespace cc |
| OLD | NEW |