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

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

Issue 2828373003: Stop updating FileSelection when not changed.
Patch Set: Address review comments. Created 3 years, 8 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/file_selection.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_selection.js b/ui/file_manager/file_manager/foreground/js/file_selection.js
index fa7a0529a9dbbf88c8f845c1d62835e6a748c450..df2bc0726fe4ddde1f4ad2a498077bf975e62bf2 100644
--- a/ui/file_manager/file_manager/foreground/js/file_selection.js
+++ b/ui/file_manager/file_manager/foreground/js/file_selection.js
@@ -180,6 +180,16 @@ FileSelectionHandler.prototype.onFileSelectionChanged = function() {
return /** @type {!Entry} */ (
this.fileManager_.getFileList().item(index));
}.bind(this));
+
+ var isSelectionChanged = (indexes.length !== this.selection.indexes.length);
+ for (var i = 0; i < indexes.length && !isSelectionChanged; i++) {
hirono 2017/04/21 04:55:03 Sorry one more thing. The selection change like [0
tetsui2 2017/04/21 05:15:35 It's okay to overlook some non-changes unless it's
+ if (entries[i].toURL() !== this.selection.entries[i].toURL()) {
fukino 2017/04/21 05:44:31 nit: Let's extract a utility function to compare t
+ isSelectionChanged = true;
+ }
+ }
+ if (!isSelectionChanged) {
+ return;
+ }
this.selection = new FileSelection(indexes, entries);
if (this.selectionUpdateTimer_) {
« 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