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

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

Issue 1410973008: Added an experiment for an LRU snapshot cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
Index: ios/chrome/browser/snapshots/snapshot_cache.h
diff --git a/ios/chrome/browser/snapshots/snapshot_cache.h b/ios/chrome/browser/snapshots/snapshot_cache.h
index 6932726ee6ea7514f4854c0878f0de40510a6c42..28e2c477070ee52ef974b133ffa4a409c9ac57da 100644
--- a/ios/chrome/browser/snapshots/snapshot_cache.h
+++ b/ios/chrome/browser/snapshots/snapshot_cache.h
@@ -10,6 +10,7 @@
#include "base/mac/objc_property_releaser.h"
#include "base/mac/scoped_nsobject.h"
#include "base/time/time.h"
+#import "ios/chrome/browser/snapshots/lru_cache.h"
typedef void (^GreyBlock)(UIImage*);
@@ -23,6 +24,12 @@ typedef void (^GreyBlock)(UIImage*);
// Dictionary to hold color snapshots in memory. n.b. Color snapshots are not
// kept in memory on tablets.
base::scoped_nsobject<NSMutableDictionary> imageDictionary_;
+
+ // Cache to hold color snapshots in memory. n.b. Color snapshots are not
+ // kept in memory on tablets. It is used in place of the imageDictionary_ when
+ // the LRU cache snapshot experiment is enabled.
+ base::scoped_nsobject<LRUCache> lruCache_;
+
// Temporary dictionary to hold grey snapshots for tablet side swipe. This
// will be nil before -createGreyCache is called and after -removeGreyCache
// is called.
@@ -90,4 +97,11 @@ typedef void (^GreyBlock)(UIImage*);
- (void)saveGreyInBackgroundForSessionID:(NSString*)sessionID;
@end
+// Additionnal methods that should only be used for tests.
+@interface SnapshotCache (TestingAdditions)
+- (BOOL)hasImageInMemory:(NSString*)sessionID;
+- (BOOL)hasGreyImageInMemory:(NSString*)sessionID;
+- (NSUInteger)lruCacheMaxSize;
+@end
+
#endif // IOS_CHROME_BROWSER_SNAPSHOTS_SNAPSHOT_CACHE_H_

Powered by Google App Engine
This is Rietveld 408576698