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

Unified Diff: ios/chrome/browser/snapshots/snapshot_cache.mm

Issue 1687453002: Fixed leak on LRU snapshot cache implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/snapshots/snapshot_cache.mm
diff --git a/ios/chrome/browser/snapshots/snapshot_cache.mm b/ios/chrome/browser/snapshots/snapshot_cache.mm
index b76ba6ec4889a46a04b4918c50947aa44e51b81c..05622576f634a4d0ff93bd8257d4207983a80476 100644
--- a/ios/chrome/browser/snapshots/snapshot_cache.mm
+++ b/ios/chrome/browser/snapshots/snapshot_cache.mm
@@ -389,8 +389,8 @@ void ConvertAndSaveGreyImage(
- (void)handleLowMemory {
DCHECK(!IsIPadIdiom());
DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI);
- NSMutableDictionary* dictionary =
- [[NSMutableDictionary alloc] initWithCapacity:2];
+ base::scoped_nsobject<NSMutableDictionary> dictionary(
+ [[NSMutableDictionary alloc] initWithCapacity:2]);
for (NSString* sessionID in pinnedIDs_) {
UIImage* image = nil;
if (lruCache_)
@@ -403,9 +403,10 @@ void ConvertAndSaveGreyImage(
if (lruCache_) {
[lruCache_ removeAllObjects];
for (NSString* sessionID in pinnedIDs_)
- [lruCache_ setObject:dictionary[sessionID] forKey:sessionID];
+ [lruCache_ setObject:[dictionary objectForKey:sessionID]
+ forKey:sessionID];
} else {
- imageDictionary_.reset(dictionary);
+ imageDictionary_ = dictionary;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698