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

Unified Diff: ui/file_manager/image_loader/image_loader_client.js

Issue 890313002: Change ImageLoaderClient to return width and height of image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « ui/file_manager/image_loader/cache.js ('k') | ui/file_manager/image_loader/request.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « ui/file_manager/image_loader/cache.js ('k') | ui/file_manager/image_loader/request.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698