Bug 1096913 - Remove the simple cache entry when replacing the cache entry. r=mwu, a=lmandel
authorBas Schouten <bschouten@mozilla.com>
Tue, 11 Nov 2014 22:09:32 +0000
changeset 226052 e1ee2331bd12
parent 226051 117eb4e49c72
child 226053 e685be9bd4d6
push id4126
push userryanvm@gmail.com
push date2014-11-13 21:00 +0000
treeherdermozilla-beta@3e5cb63660bd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu, lmandel
bugs1096913
milestone34.0
Bug 1096913 - Remove the simple cache entry when replacing the cache entry. r=mwu, a=lmandel This solves the issue since *mRequest may be different for the replacing entry, causing the simple cache entry never to be removed from NotifyExpired or replaced. And the simple cache to grow indefinitely.
dom/canvas/CanvasImageCache.cpp
--- a/dom/canvas/CanvasImageCache.cpp
+++ b/dom/canvas/CanvasImageCache.cpp
@@ -244,16 +244,17 @@ CanvasImageCache::NotifyDrawImage(Elemen
   }
 
   ImageCacheEntry* entry = gImageCache->mCache.PutEntry(ImageCacheKey(aImage, aCanvas));
   if (entry) {
     if (entry->mData->mSourceSurface) {
       // We are overwriting an existing entry.
       gImageCache->mTotal -= entry->mData->SizeInBytes();
       gImageCache->RemoveObject(entry->mData);
+      gImageCache->mSimpleCache.RemoveEntry(*entry->mData->mRequest);
     }
     gImageCache->AddObject(entry->mData);
 
     nsCOMPtr<nsIImageLoadingContent> ilc = do_QueryInterface(aImage);
     if (ilc) {
       ilc->GetRequest(nsIImageLoadingContent::CURRENT_REQUEST,
                       getter_AddRefs(entry->mData->mRequest));
     }