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

Unified Diff: ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js

Issue 877513003: Do not enqueue a prefetch task when it prefetched to the end of list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test case. 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
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
diff --git a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
index 517f65b4409d65ccbab8d08f32e3f6e4d9a8c5ba..ca7500945c715ff98c230b1e38e45a689d40701c 100644
--- a/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
+++ b/ui/file_manager/file_manager/foreground/js/list_thumbnail_loader.js
@@ -86,7 +86,7 @@ function ListThumbnailLoader(
this.endIndex_ = 0;
/**
- * Cursor begins from 0, and the origin in the list is beginIndex_.
+ * Cursor.
* @type {number}
* @private
*/
@@ -118,7 +118,7 @@ ListThumbnailLoader.prototype.onSplice_ = function(event) {
delete this.cache_[removedItem.toURL()];
}
- this.cursor_ = 0;
+ this.cursor_ = this.beginIndex_;
this.continue_();
}
@@ -135,7 +135,7 @@ ListThumbnailLoader.prototype.setHighPriorityRange = function(
this.beginIndex_ = beginIndex;
this.endIndex_ = endIndex;
- this.cursor_ = 0;
+ this.cursor_ = this.beginIndex_;
this.continue_();
}
@@ -143,7 +143,7 @@ ListThumbnailLoader.prototype.setHighPriorityRange = function(
/**
* Returns a thumbnail of an entry if it is in cache.
*
- * @return {!Object} If the thumbnail is not in cache, this returns null.
+ * @return {Object} If the thumbnail is not in cache, this returns null.
*/
ListThumbnailLoader.prototype.getThumbnailFromCache = function(entry) {
return this.cache_[entry.toURL()] || null;
@@ -160,10 +160,7 @@ ListThumbnailLoader.prototype.continue_ = function() {
return;
}
- var index = (this.beginIndex_ + this.cursor_) % this.dataModel_.length;
- this.cursor_ += 1;
-
- var entry = /** @type {Entry} */ (this.dataModel_.item(index));
+ var entry = /** @type {Entry} */ (this.dataModel_.item(this.cursor_++));
// If the entry is a directory, already in cache or fetching, skip it.
if (entry.isDirectory ||
« no previous file with comments | « no previous file | ui/file_manager/file_manager/foreground/js/list_thumbnail_loader_unittest.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698