Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(660)

Side by Side Diff: cc/tiles/software_image_decode_cache.cc

Issue 2795803002: Clear Image Decode Cache on Navigation (Closed)
Patch Set: fix conversion Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 ReduceCacheUsageUntilWithinLimit(0);
824 }
825
821 void SoftwareImageDecodeCache::RemovePendingTask(const ImageKey& key, 826 void SoftwareImageDecodeCache::RemovePendingTask(const ImageKey& key,
822 DecodeTaskType task_type) { 827 DecodeTaskType task_type) {
823 base::AutoLock lock(lock_); 828 base::AutoLock lock(lock_);
824 switch (task_type) { 829 switch (task_type) {
825 case DecodeTaskType::USE_IN_RASTER_TASKS: 830 case DecodeTaskType::USE_IN_RASTER_TASKS:
826 pending_in_raster_image_tasks_.erase(key); 831 pending_in_raster_image_tasks_.erase(key);
827 break; 832 break;
828 case DecodeTaskType::USE_OUT_OF_RASTER_TASKS: 833 case DecodeTaskType::USE_OUT_OF_RASTER_TASKS:
829 pending_out_of_raster_image_tasks_.erase(key); 834 pending_out_of_raster_image_tasks_.erase(key);
830 break; 835 break;
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 } 1182 }
1178 } 1183 }
1179 } 1184 }
1180 1185
1181 void SoftwareImageDecodeCache::OnPurgeMemory() { 1186 void SoftwareImageDecodeCache::OnPurgeMemory() {
1182 base::AutoLock lock(lock_); 1187 base::AutoLock lock(lock_);
1183 ReduceCacheUsageUntilWithinLimit(0); 1188 ReduceCacheUsageUntilWithinLimit(0);
1184 } 1189 }
1185 1190
1186 } // namespace cc 1191 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/software_image_decode_cache.h ('k') | cc/tiles/software_image_decode_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698