Index: ui/file_manager/gallery/js/gallery_item.js |
diff --git a/ui/file_manager/gallery/js/gallery_item.js b/ui/file_manager/gallery/js/gallery_item.js |
index 18c9c95043050a6a1e5a065cb6ac44b8a3cb17f7..1cc87848b80446ce2833a8d3fb906910bca9b85f 100644 |
--- a/ui/file_manager/gallery/js/gallery_item.js |
+++ b/ui/file_manager/gallery/js/gallery_item.js |
@@ -27,10 +27,34 @@ Gallery.Item = function(entry, metadata, metadataCache, original) { |
/** |
* @type {MetadataCache} |
+ * @private |
*/ |
this.metadataCache_ = metadataCache; |
/** |
+ * The content cache is used for prefetching the next image when going through |
+ * the images sequentially. The real life photos can be large (18Mpix = 72Mb |
+ * pixel array) so we want only the minimum amount of caching. |
+ * @type {Canvas} |
+ */ |
+ this.screenImage = null; |
+ |
+ /** |
+ * We reuse previously generated screen-scale images so that going back to a |
+ * recently loaded image looks instant even if the image is not in the content |
+ * cache any more. Screen-scale images are small (~1Mpix) so we can afford to |
+ * cache more of them. |
+ * @type {Canvas} |
+ */ |
+ this.contentImage = null; |
+ |
+ /** |
+ * Last accessed date to be used for selecting items whose cache are evicted. |
+ * @type {number} |
+ */ |
+ this.lastAccessed_ = Date.now(); |
+ |
+ /** |
* @type {boolean} |
* @private |
*/ |
@@ -90,6 +114,22 @@ Gallery.Item.prototype.getFileName = function() { |
*/ |
Gallery.Item.prototype.isOriginal = function() { return this.original_; }; |
+/** |
+ * Obtains the last accessed date. |
+ * @return {number} Last accessed date. |
+ */ |
+Gallery.Item.prototype.getLastAccessedDate = function() { |
+ return this.lastAccessed_; |
+}; |
+ |
+/** |
+ * Updates the last accessed date. |
+ */ |
+Gallery.Item.prototype.touch = function() { |
+ this.lastAccessed_ = Date.now(); |
+}; |
+ |
+ |
// TODO: Localize? |
/** |
* @type {string} Suffix for a edited copy file name. |