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

Unified Diff: ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js

Issue 895723003: Add MetadataCacheSetStorage implementation for LRUCache. (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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js
index 9fc872f7a9b4baf44dcbf468ef4d0441d7956a3b..15f4693999b83e94fd74f92efe89d79f14d250c7 100644
--- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js
+++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js
@@ -134,7 +134,6 @@ MetadataCacheSet.prototype.hasFreshCache = function(entries, names) {
/**
* Interface of raw strage for MetadataCacheItem.
- * TODO(hirono): Add implementation of the interface for LRUCache.
* @interface
*/
function MetadataCacheSetStorage() {
@@ -173,19 +172,64 @@ function MetadataCacheSetStorageForObject(items) {
this.items_ = items;
}
+/**
+ * @override
+ */
MetadataCacheSetStorageForObject.prototype.get = function(url) {
return this.items_[url];
};
+/**
+ * @override
+ */
MetadataCacheSetStorageForObject.prototype.peek = function(url) {
return this.items_[url];
};
+/**
+ * @override
+ */
MetadataCacheSetStorageForObject.prototype.put = function(url, item) {
this.items_[url] = item;
};
/**
+ * Implementation of MetadataCacheSetStorage by using LRUCache.
+ * @param {!LRUCache<!MetadataCacheItem>} cache LRUCache.
+ * @constructor
+ * @implements {MetadataCacheSetStorage}
+ * @struct
+ */
+function MetadataCacheSetStorageForLRUCache(cache) {
+ /**
+ * @private {!LRUCache<!MetadataCacheItem>}
+ * @const
+ */
+ this.cache_ = cache;
+}
+
+/**
+ * @override
+ */
+MetadataCacheSetStorageForLRUCache.prototype.get = function(url) {
+ return this.cache_.get(url);
+};
+
+/**
+ * @override
+ */
+MetadataCacheSetStorageForLRUCache.prototype.peek = function(url) {
+ return this.cache_.peek(url);
+};
+
+/**
+ * @override
+ */
+MetadataCacheSetStorageForLRUCache.prototype.put = function(url, item) {
+ this.cache_.put(url, item);
+};
+
+/**
* @param {!FileEntry} entry Entry
* @param {!Array<string>} names Property name list to be requested.
* @constructor
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698