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

Unified Diff: cc/tiles/gpu_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/tiles/gpu_image_decode_cache.h ('k') | cc/tiles/gpu_image_decode_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/tiles/gpu_image_decode_cache.cc
diff --git a/cc/tiles/gpu_image_decode_cache.cc b/cc/tiles/gpu_image_decode_cache.cc
index 70216a376f1a91890b4520d57f45c9cc1697d844..fcb06057be5484052e6ad68ae5408bc6d8409896 100644
--- a/cc/tiles/gpu_image_decode_cache.cc
+++ b/cc/tiles/gpu_image_decode_cache.cc
@@ -584,6 +584,26 @@ void GpuImageDecodeCache::SetShouldAggressivelyFreeResources(
}
}
+void GpuImageDecodeCache::ClearCache() {
+ base::AutoLock lock(lock_);
+ for (auto it = persistent_cache_.begin(); it != persistent_cache_.end();) {
+ if (it->second->decode.ref_count != 0 ||
+ it->second->upload.ref_count != 0) {
+ ++it;
+ continue;
+ }
+
+ if (it->second->upload.image()) {
+ bytes_used_ -= it->second->size;
+ images_pending_deletion_.push_back(it->second->upload.image());
+ it->second->upload.SetImage(nullptr);
+ it->second->upload.budgeted = false;
+ }
+
+ it = persistent_cache_.Erase(it);
+ }
+}
+
bool GpuImageDecodeCache::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) {
« no previous file with comments | « cc/tiles/gpu_image_decode_cache.h ('k') | cc/tiles/gpu_image_decode_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698