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

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

Issue 892083004: Files.app: Use new metadata models in DirectoryModel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 years, 10 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
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 15f4693999b83e94fd74f92efe89d79f14d250c7..fb31d427950081f4d45546776aa51fe95f1daa94 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
@@ -103,6 +103,16 @@ MetadataCacheSet.prototype.invalidate = function(requestId, entries) {
};
/**
+ * Clears the caches of entries.
+ * @param {!Array<!FileEntry>} entries
+ */
+MetadataCacheSet.prototype.clear = function(entries) {
+ for (var i = 0; i < entries.length; i++) {
+ this.items_.remove(entries[i].toURL());
+ }
+};
+
+/**
* Creates snapshot of the cache for entries.
* @param {!Array<!FileEntry>} entries
*/
@@ -162,6 +172,12 @@ MetadataCacheSetStorage.prototype.peek = function(url) {};
MetadataCacheSetStorage.prototype.put = function(url, item) {};
/**
+ * Removes an item from the cache.
+ * @param {string} url Entry URL.
+ */
+MetadataCacheSetStorage.prototype.remove = function(url) {};
+
+/**
* Implementation of MetadataCacheSetStorage by using raw object.
* @param {Object} items Map of URL and MetadataCacheItem.
* @constructor
@@ -194,6 +210,13 @@ MetadataCacheSetStorageForObject.prototype.put = function(url, item) {
};
/**
+ * @override
+ */
+MetadataCacheSetStorageForObject.prototype.remove = function(url) {
+ delete this.items_[url];
+};
+
+/**
* Implementation of MetadataCacheSetStorage by using LRUCache.
* @param {!LRUCache<!MetadataCacheItem>} cache LRUCache.
* @constructor
@@ -230,6 +253,13 @@ MetadataCacheSetStorageForLRUCache.prototype.put = function(url, item) {
};
/**
+ * @override
+ */
+MetadataCacheSetStorageForLRUCache.prototype.remove = function(url) {
+ this.cache_.remove(url);
+};
+
+/**
* @param {!FileEntry} entry Entry
* @param {!Array<string>} names Property name list to be requested.
* @constructor

Powered by Google App Engine
This is Rietveld 408576698