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

Unified Diff: ui/file_manager/file_manager/audio_player/js/audio_player.js

Issue 515443002: Audio Player: Don't update the track list when the list is not changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « 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/audio_player/js/audio_player.js
diff --git a/ui/file_manager/file_manager/audio_player/js/audio_player.js b/ui/file_manager/file_manager/audio_player/js/audio_player.js
index 55eef285469e54f085100c131385b213af387911..50f985afb81f0e56639133a3deffbecfee713573 100644
--- a/ui/file_manager/file_manager/audio_player/js/audio_player.js
+++ b/ui/file_manager/file_manager/audio_player/js/audio_player.js
@@ -117,18 +117,25 @@ AudioPlayer.prototype.load = function(playlist) {
return;
var newTracks = [];
+ var currentTracks = this.player_.tracks;
+ var unchanged = (currentTracks.length === this.entries_.length);
for (var i = 0; i != this.entries_.length; i++) {
var entry = this.entries_[i];
- var onClick = this.select_.bind(this, i, false /* no restore */);
+ var onClick = this.select_.bind(this, i);
newTracks.push(new AudioPlayer.TrackInfo(entry, onClick));
+
+ if (unchanged && entry.toURL() !== currentTracks[i].url)
+ unchanged = false;
}
- this.player_.tracks = newTracks;
+ if (!unchanged) {
+ this.player_.tracks = newTracks;
- // Makes it sure that the handler of the track list is called, before the
- // handler of the track index.
- Platform.performMicrotaskCheckpoint();
+ // Makes it sure that the handler of the track list is called, before
+ // the handler of the track index.
+ Platform.performMicrotaskCheckpoint();
+ }
this.select_(position, !!time);
« 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