| Index: ui/file_manager/image_loader/cache.js
|
| diff --git a/ui/file_manager/image_loader/cache.js b/ui/file_manager/image_loader/cache.js
|
| index c66ae983bb3ae2dbb7b99dda107d9ce86d492b54..b9eb698238af5005e1869d3ba16a4987fbfb938e 100644
|
| --- a/ui/file_manager/image_loader/cache.js
|
| +++ b/ui/file_manager/image_loader/cache.js
|
| @@ -27,7 +27,7 @@ Cache.DB_NAME = 'image-loader';
|
| * @type {number}
|
| * @const
|
| */
|
| -Cache.DB_VERSION = 11;
|
| +Cache.DB_VERSION = 12;
|
|
|
| /**
|
| * Memory limit for images data in bytes.
|
| @@ -215,10 +215,12 @@ Cache.prototype.evictCache_ = function(
|
| *
|
| * @param {string} key Cache key.
|
| * @param {string} data Image data.
|
| + * @param {number} width Image width.
|
| + * @param {number} height Image height.
|
| * @param {number} timestamp Last modification timestamp. Used to detect
|
| * if the cache entry becomes out of date.
|
| */
|
| -Cache.prototype.saveImage = function(key, data, timestamp) {
|
| +Cache.prototype.saveImage = function(key, data, width, height, timestamp) {
|
| if (!this.db_) {
|
| console.warn('Cache database not available.');
|
| return;
|
| @@ -228,6 +230,8 @@ Cache.prototype.saveImage = function(key, data, timestamp) {
|
| var metadataEntry = {
|
| key: key,
|
| timestamp: timestamp,
|
| + width: width,
|
| + height: height,
|
| size: data.length,
|
| lastLoadTimestamp: Date.now()};
|
| var dataEntry = {key: key, data: data};
|
| @@ -256,7 +260,8 @@ Cache.prototype.saveImage = function(key, data, timestamp) {
|
| * @param {string} key Cache key.
|
| * @param {number} timestamp Last modification timestamp. If different
|
| * that the one in cache, then the entry will be invalidated.
|
| - * @param {function(string)} onSuccess Success callback with the image's data.
|
| + * @param {function(string, number, number)} onSuccess Success callback with
|
| + * the image's data, width, height.
|
| * @param {function()} onFailure Failure callback.
|
| */
|
| Cache.prototype.loadImage = function(key, timestamp, onSuccess, onFailure) {
|
| @@ -303,7 +308,7 @@ Cache.prototype.loadImage = function(key, timestamp, onSuccess, onFailure) {
|
| // image data.
|
| metadataEntry.lastLoadTimestamp = Date.now();
|
| metadataStore.put(metadataEntry); // Added asynchronously.
|
| - onSuccess(dataEntry.data);
|
| + onSuccess(dataEntry.data, metadataEntry.width, metadataEntry.height);
|
| }
|
| }.bind(this);
|
|
|
|
|