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

Unified Diff: chrome/browser/resources/file_manager/js/media/media_util.js

Issue 14623021: Introduce a priority queue to the image loader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up. Created 7 years, 7 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: chrome/browser/resources/file_manager/js/media/media_util.js
diff --git a/chrome/browser/resources/file_manager/js/media/media_util.js b/chrome/browser/resources/file_manager/js/media/media_util.js
index d039f1a3a2fae5f59fa30e3d827ae2df14d4ebe9..db09006a5c1e6e514ad86aa575b944382e44fbbd 100644
--- a/chrome/browser/resources/file_manager/js/media/media_util.js
+++ b/chrome/browser/resources/file_manager/js/media/media_util.js
@@ -16,15 +16,17 @@
* @param {string=} opt_mediaType Media type.
* @param {ThumbnailLoader.UseEmbedded=} opt_useEmbedded If to use embedded
* jpeg thumbnail if available. Default: USE_EMBEDDED.
+ * @param {number=} opt_priority Priority, the highest is 0. default: 2.
* @constructor
*/
-function ThumbnailLoader(
- url, opt_loaderType, opt_metadata, opt_mediaType, opt_useEmbedded) {
+function ThumbnailLoader(url, opt_loaderType, opt_metadata, opt_mediaType,
+ opt_useEmbedded, opt_priority) {
opt_useEmbedded = opt_useEmbedded || ThumbnailLoader.UseEmbedded.USE_EMBEDDED;
this.mediaType_ = opt_mediaType || FileType.getMediaType(url);
this.loaderType_ = opt_loaderType || ThumbnailLoader.LoaderType.IMAGE;
this.metadata_ = opt_metadata;
+ this.priority_ = (opt_priority !== undefined) ? opt_priority : 2;
if (!opt_metadata) {
this.thumbnailUrl_ = url; // Use the URL directly.
@@ -155,8 +157,10 @@ ThumbnailLoader.prototype.load = function(box, fillMode, opt_optimizationMode,
if (this.fallbackUrl_) {
new ThumbnailLoader(this.fallbackUrl_,
this.loaderType_,
- null,
- this.mediaType_).
+ null, // No metadata.
+ this.mediaType_,
+ undefined, // Default value for use-embedded.
+ this.priority_).
load(box, fillMode, opt_onSuccess);
} else {
box.setAttribute('generic-thumbnail', this.mediaType_);
@@ -180,6 +184,7 @@ ThumbnailLoader.prototype.load = function(box, fillMode, opt_optimizationMode,
{ maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT,
cache: true,
+ priority: this.priority_,
timestamp: modificationTime },
function() {
if (opt_optimizationMode ==
@@ -261,6 +266,7 @@ ThumbnailLoader.prototype.loadDetachedImage = function(callback) {
{ maxWidth: ThumbnailLoader.THUMBNAIL_MAX_WIDTH,
maxHeight: ThumbnailLoader.THUMBNAIL_MAX_HEIGHT,
cache: true,
+ priority: this.priority_,
timestamp: modificationTime });
};

Powered by Google App Engine
This is Rietveld 408576698