Chromium Code Reviews| 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 811 it = decoded_images_.Erase(it); | 811 it = decoded_images_.Erase(it); |
| 812 --num_to_remove; | 812 --num_to_remove; |
| 813 } | 813 } |
| 814 } | 814 } |
| 815 | 815 |
| 816 void SoftwareImageDecodeCache::ReduceCacheUsage() { | 816 void SoftwareImageDecodeCache::ReduceCacheUsage() { |
| 817 base::AutoLock lock(lock_); | 817 base::AutoLock lock(lock_); |
| 818 ReduceCacheUsageUntilWithinLimit(max_items_in_cache_); | 818 ReduceCacheUsageUntilWithinLimit(max_items_in_cache_); |
| 819 } | 819 } |
| 820 | 820 |
| 821 void SoftwareImageDecodeCache::ClearCache() { | |
| 822 base::AutoLock lock(lock_); | |
| 823 LOG(ERROR) << "Clearing " << decoded_images_.size() << " images."; | |
|
vmpstr
2017/04/03 18:46:10
Debugging? Can this be a trace instead?
ericrk
2017/04/04 00:26:03
my bad - left this in from debugging. removed.
| |
| 824 ReduceCacheUsageUntilWithinLimit(0); | |
| 825 } | |
| 826 | |
| 821 void SoftwareImageDecodeCache::RemovePendingTask(const ImageKey& key, | 827 void SoftwareImageDecodeCache::RemovePendingTask(const ImageKey& key, |
| 822 DecodeTaskType task_type) { | 828 DecodeTaskType task_type) { |
| 823 base::AutoLock lock(lock_); | 829 base::AutoLock lock(lock_); |
| 824 switch (task_type) { | 830 switch (task_type) { |
| 825 case DecodeTaskType::USE_IN_RASTER_TASKS: | 831 case DecodeTaskType::USE_IN_RASTER_TASKS: |
| 826 pending_in_raster_image_tasks_.erase(key); | 832 pending_in_raster_image_tasks_.erase(key); |
| 827 break; | 833 break; |
| 828 case DecodeTaskType::USE_OUT_OF_RASTER_TASKS: | 834 case DecodeTaskType::USE_OUT_OF_RASTER_TASKS: |
| 829 pending_out_of_raster_image_tasks_.erase(key); | 835 pending_out_of_raster_image_tasks_.erase(key); |
| 830 break; | 836 break; |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1177 } | 1183 } |
| 1178 } | 1184 } |
| 1179 } | 1185 } |
| 1180 | 1186 |
| 1181 void SoftwareImageDecodeCache::OnPurgeMemory() { | 1187 void SoftwareImageDecodeCache::OnPurgeMemory() { |
| 1182 base::AutoLock lock(lock_); | 1188 base::AutoLock lock(lock_); |
| 1183 ReduceCacheUsageUntilWithinLimit(0); | 1189 ReduceCacheUsageUntilWithinLimit(0); |
| 1184 } | 1190 } |
| 1185 | 1191 |
| 1186 } // namespace cc | 1192 } // namespace cc |
| OLD | NEW |