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

Unified Diff: cc/tiles/gpu_image_decode_cache.cc

Issue 2945813002: cc: Interface to evict images from cc image decode cache. (Closed)
Patch Set: rebase Created 3 years, 6 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 4713e8be9a0cad47224402d2eb1689bf121a20ed..a6b9228a94a4ae71bc6d9d5cd4c930862fa78a7c 100644
--- a/cc/tiles/gpu_image_decode_cache.cc
+++ b/cc/tiles/gpu_image_decode_cache.cc
@@ -659,6 +659,23 @@ size_t GpuImageDecodeCache::GetMaximumMemoryLimitBytes() const {
return normal_max_cache_bytes_;
}
+void GpuImageDecodeCache::NotifyImageUnused(uint32_t skimage_id) {
+ auto it = persistent_cache_.Peek(skimage_id);
+ if (it != persistent_cache_.end()) {
+ if (it->second->decode.ref_count != 0 ||
+ it->second->upload.ref_count != 0) {
+ it->second->is_orphaned = true;
+ } else if (it->second->upload.image()) {
+ DCHECK(!it->second->decode.is_locked());
+ bytes_used_ -= it->second->size;
+ images_pending_deletion_.push_back(it->second->upload.image());
+ it->second->upload.SetImage(nullptr);
+ it->second->upload.budgeted = false;
+ }
+ 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