Skip to content

Commit

Permalink
Expand intervals of rescan operations when directory contents changed.
Browse files Browse the repository at this point in the history
The listener of chrome.fileBrowserPrivate.onDirectoryChanged is called very frequently when many files are copied into a folder under Downloads.
In this case, we can't know the changed_files, so we need to rescan the folder.
As this operation is heavy, this patch adds some interval for each rescan.
Additionally, 1000ms delay might be too long for UI update, so I changed it to 500ms)

BUG=383232
TEST=manually tested the performance.

Review URL: https://codereview.chromium.org/460013003

Cr-Commit-Position: refs/heads/master@{#289871}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289871 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
fukino@chromium.org committed Aug 15, 2014
1 parent 4c72c38 commit c2d31e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ui/file_manager/file_manager/foreground/js/directory_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

// If directory files changes too often, don't rescan directory more than once
// per specified interval
var SIMULTANEOUS_RESCAN_INTERVAL = 1000;
var SIMULTANEOUS_RESCAN_INTERVAL = 500;
// Used for operations that require almost instant rescan.
var SHORT_RESCAN_INTERVAL = 100;

Expand Down Expand Up @@ -193,7 +193,9 @@ DirectoryModel.prototype.onWatcherDirectoryChanged_ = function(event) {
}.bind(this));
} else {
// Invokes force refresh if the detailed information isn't provided.
this.rescanSoon(true);
// 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);
}
};

Expand Down

0 comments on commit c2d31e3

Please sign in to comment.