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

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

Issue 488043003: Aggregate consecutive rescan request as much as possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revive AsyncUtil.Aggregation. Created 6 years, 4 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 | « ui/file_manager/file_manager/common/js/async_util.js ('k') | 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_model.js
diff --git a/ui/file_manager/file_manager/foreground/js/directory_model.js b/ui/file_manager/file_manager/foreground/js/directory_model.js
index 36c5abed2ed19605867a6d6c144a59f51f770d33..a123154e4ae817bf8c4248025e872b9644bb14c6 100644
--- a/ui/file_manager/file_manager/foreground/js/directory_model.js
+++ b/ui/file_manager/file_manager/foreground/js/directory_model.js
@@ -33,6 +33,8 @@ function DirectoryModel(singleSelection, fileFilter, fileWatcher,
this.changeDirectorySequence_ = 0;
this.directoryChangeQueue_ = new AsyncUtil.Queue();
+ this.rescanAggregator_ = new AsyncUtil.Aggregator(
+ this.rescanSoon.bind(this, true), 500);
this.fileFilter_ = fileFilter;
this.fileFilter_.addEventListener('changed',
@@ -189,13 +191,13 @@ DirectoryModel.prototype.onWatcherDirectoryChanged_ = function(event) {
}.bind(this)).catch(function(error) {
console.error('Error in proceeding the changed event.', error,
'Fallback to force-refresh');
- this.rescanSoon(true);
+ this.rescanAggregator_.run();
}.bind(this));
} else {
// Invokes force refresh if the detailed information isn't provided.
// This can occur very frequently (e.g. when copying files into Downlaods)
// and rescan is heavy operation, so we keep some interval for each rescan.
- this.rescanLater(true);
+ this.rescanAggregator_.run();
}
};
« no previous file with comments | « ui/file_manager/file_manager/common/js/async_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698