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

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

Issue 301943002: Files.app: Omit first draw without metadata in file list (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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/directory_contents.js
diff --git a/ui/file_manager/file_manager/foreground/js/directory_contents.js b/ui/file_manager/file_manager/foreground/js/directory_contents.js
index 8c95f0b7e4b8a031cb41e871f288ecf4cfb91f2a..7c315e057fb34d74064b44c447a5d895d5d111df 100644
--- a/ui/file_manager/file_manager/foreground/js/directory_contents.js
+++ b/ui/file_manager/file_manager/foreground/js/directory_contents.js
@@ -666,13 +666,18 @@ DirectoryContents.prototype.onNewEntries_ = function(entries) {
if (entriesFiltered.length === 0)
return;
- // Update the filelist without waiting the metadata.
- this.fileList_.push.apply(this.fileList_, entriesFiltered);
- cr.dispatchSimpleEvent(this, 'scan-updated');
-
- this.makeSpaceInMetadataCache_(this.fileList_.length);
+ // Enlarge the cache size into the new filelist size.
+ var newListSize = this.fileList_.length + entriesFiltered.length;
+ this.makeSpaceInMetadataCache_(newListSize);
this.processNewEntriesQueue_.run(function(callbackOuter) {
+ var finish = function() {
+ // Update the filelist without waiting the metadata.
+ this.fileList_.push.apply(this.fileList_, entriesFiltered);
+ cr.dispatchSimpleEvent(this, 'scan-updated');
+
+ callbackOuter();
+ }.bind(this);
// Because the prefetchMetadata can be slow, throttling by splitting entries
// into smaller chunks to reduce UI latency.
// TODO(hidehiko,mtomasz): This should be handled in MetadataCache.
@@ -688,16 +693,14 @@ DirectoryContents.prototype.onNewEntries_ = function(entries) {
if (!prefetchMetadataQueue.isCancelled()) {
if (this.scanCancelled_)
prefetchMetadataQueue.cancel();
- else
- cr.dispatchSimpleEvent(this, 'scan-updated');
}
// Checks if this is the last task.
if (prefetchMetadataQueue.getWaitingTasksCount() === 0 &&
prefetchMetadataQueue.getRunningTasksCount() === 1) {
- // |callbackOuter| must be called before |callbackInner|, to prevent
- // double-calling.
- callbackOuter();
+ // |callbackOuter| in |finish| must be called before
+ // |callbackInner|, to prevent double-calling.
+ finish();
}
callbackInner();
« 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