Index: ui/file_manager/image_loader/image_loader_client.js |
diff --git a/ui/file_manager/image_loader/image_loader_client.js b/ui/file_manager/image_loader/image_loader_client.js |
index f195295f3e8bf2e24c1e621b9a81cd500a4fe7f8..00e65626e98984b16f314debeec64c99cd1d9089 100644 |
--- a/ui/file_manager/image_loader/image_loader_client.js |
+++ b/ui/file_manager/image_loader/image_loader_client.js |
@@ -28,7 +28,8 @@ function ImageLoaderClient() { |
/** |
* LRU cache for images. |
- * @type {!LRUCache.<{data: string, timestamp: ?number}>} |
+ * @type {!LRUCache.<{ |
+ * data: string, width:number, height:number, timestamp: ?number}>} |
* @private |
*/ |
this.cache_ = new LRUCache(ImageLoaderClient.CACHE_MEMORY_LIMIT); |
@@ -164,9 +165,13 @@ ImageLoaderClient.prototype.load = function( |
this.cache_.remove(cacheKey); |
cachedValue = null; |
} |
- if (cachedValue && cachedValue.data) { |
+ if (cachedValue && cachedValue.data && |
+ cachedValue.width && cachedValue.height) { |
ImageLoaderClient.recordBinary('Cache.HitMiss', true); |
- callback({status: 'success', data: cachedValue.data}); |
+ callback({ |
+ status: 'success', data: cachedValue.data, |
+ width: cachedValue.width, height: cachedValue.height |
+ }); |
return null; |
} else { |
ImageLoaderClient.recordBinary('Cache.HitMiss', false); |
@@ -195,7 +200,7 @@ ImageLoaderClient.prototype.load = function( |
if (cacheKey && result.status == 'success' && opt_options.cache) { |
var value = { |
timestamp: opt_options.timestamp ? opt_options.timestamp : null, |
- data: result.data |
+ data: result.data, width: result.width, height: result.height |
}; |
this.cache_.put(cacheKey, value, result.data.length); |
} |