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 1dd9f10cd7a59d4859d6c062093a915cbbb48d55..21518b77998965d21a9a1ea1ad24351051d1eea9 100644 |
--- a/cc/tiles/gpu_image_decode_cache.cc |
+++ b/cc/tiles/gpu_image_decode_cache.cc |
@@ -623,6 +623,22 @@ 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() && !it->second->decode.is_locked()) { |
vmpstr
2017/06/19 16:34:41
I _believe_ you can still mark things as orphaned
ericrk
2017/06/19 17:09:30
Agreed - you shouldn't need to check is_locked her
sohan
2017/06/20 13:31:39
Done.
|
+ if (it->second->decode.ref_count != 0 || |
+ it->second->upload.ref_count != 0) { |
+ it->second->is_orphaned = true; |
+ } else 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; |
+ } |
+ persistent_cache_.Erase(it); |
+ } |
+} |
+ |
bool GpuImageDecodeCache::OnMemoryDump( |
const base::trace_event::MemoryDumpArgs& args, |
base::trace_event::ProcessMemoryDump* pmd) { |