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

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

Issue 687073002: Fix fallback in Metadata Cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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.js
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache.js
index f20b26b2efc4984be1a6097fe7b6679444e1f682..fd46339fd9ec0d98cf2bd7976a098ef7d56cd08a 100644
--- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache.js
+++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache.js
@@ -358,8 +358,13 @@ MetadataCache.prototype.getOneInternal_ =
var tryNextProvider = function() {
if (providers.length === 0) {
+ // If not found, then mark the property as unavailable, so it's not
+ // retrieved again.
+ if (!(type in item.properties))
+ item.properties[type] = null;
+
self.endBatchUpdates();
- setTimeout(callback.bind(null, item.properties[type] || null), 0);
+ setTimeout(callback.bind(null, item.properties[type]), 0);
return;
}
@@ -892,22 +897,25 @@ ExternalProvider.prototype.convert_ = function(data, entry) {
modificationTime: new Date(data.lastModifiedTime)
};
- if (data.isPresent) {
- // If the file is present, don't fill the thumbnail here and allow to
- // generate it by next providers.
- result.thumbnail = null;
- } else if ('thumbnailUrl' in data) {
- result.thumbnail = {
- url: data.thumbnailUrl,
- transform: null
- };
- } else {
- // Not present in cache, so do not allow to generate it by next providers.
- result.thumbnail = {url: '', transform: null};
+ // TODO(mtomasz): Remove all of the if logic in the new metadata cache.
+ // If the file is not present, then use the thumbnail url instead of
+ // extracting the thumbnail from contents.
+ if (data.isPresent === false) {
+ if ('thumbnailUrl' in data) {
+ result.thumbnail = {
+ url: data.thumbnailUrl,
+ transform: null
+ };
+ } else {
+ // Not present in cache, so do not allow to generate it by next providers.
+ result.thumbnail = {url: '', transform: null};
+ }
}
- // If present in cache, then allow to fetch media by next providers.
- result.media = data.isPresent ? null : {};
+ // If not present in cache, then do not allow to fetch media by next
+ // providers.
+ if (data.isPresent === false)
+ result.media = {};
return result;
};
« 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