Chromium Code Reviews| 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 5aa0678138ee08b0b6f68232d8bb6da702c7da7e..49b0d2c55c604bf2236434cdc44a80f5ef3bf873 100644 |
| --- a/ui/file_manager/file_manager/foreground/js/directory_contents.js |
| +++ b/ui/file_manager/file_manager/foreground/js/directory_contents.js |
| @@ -824,6 +824,14 @@ DirectoryContents.prototype.onNewEntries_ = function(refresh, entries) { |
| this.processNewEntriesQueue_.run(function(callbackOuter) { |
| var finish = function() { |
| if (!this.scanCancelled_) { |
| + // Just before inserting entries into the file list, check and avoid |
| + // duplication. |
| + var currentURLs = {}; |
| + for (var i = 0; i < this.fileList_.length; i++) |
| + currentURLs[this.fileList_.item(i).toURL()] = true; |
|
fukino
2014/10/27 05:09:49
This duplication check add some cost, but this doe
|
| + entriesFiltered = entriesFiltered.filter(function(entry) { |
| + return !currentURLs[entry.toURL()]; |
| + }); |
| // Update the filelist without waiting the metadata. |
| this.fileList_.push.apply(this.fileList_, entriesFiltered); |
| cr.dispatchSimpleEvent(this, 'scan-updated'); |