Commit 3027da7a authored by yawano's avatar yawano Committed by Commit bot

Dispatch directory-changed event before rescan starts.

Directory rescan sometimes uses up IO and blocks other IOs which are necessary
for updating the top-left breadcrumb. While this CL does not solve the real
cause of the issue, this CL mitigates the problem by dispatching event earlier.

BUG=459864
TEST=manually tested as described in the issue

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

Cr-Commit-Position: refs/heads/master@{#317021}
parent c67ba3fd
......@@ -919,6 +919,18 @@ DirectoryModel.prototype.changeDirectoryEntry = function(
var previousDirEntry =
this.currentDirContents_.getDirectoryEntry();
var previousVolumeInfo =
previousDirEntry ?
this.volumeManager_.getVolumeInfo(previousDirEntry) : null;
// VolumeInfo for dirEntry.
var currentVolumeInfo = this.getCurrentVolumeInfo();
var event = new Event('directory-changed');
event.previousDirEntry = previousDirEntry;
event.newDirEntry = dirEntry;
event.volumeChanged = previousVolumeInfo !== currentVolumeInfo;
this.dispatchEvent(event);
this.clearAndScan_(
newDirectoryContents,
function(result) {
......@@ -934,16 +946,6 @@ DirectoryModel.prototype.changeDirectoryEntry = function(
// For tests that open the dialog to empty directories, everything
// is loaded at this point.
util.testSendMessage('directory-change-complete');
var previousVolumeInfo =
previousDirEntry ?
this.volumeManager_.getVolumeInfo(previousDirEntry) : null;
// VolumeInfo for dirEntry.
var currentVolumeInfo = this.getCurrentVolumeInfo();
var event = new Event('directory-changed');
event.previousDirEntry = previousDirEntry;
event.newDirEntry = dirEntry;
event.volumeChanged = previousVolumeInfo !== currentVolumeInfo;
this.dispatchEvent(event);
}.bind(this));
}.bind(this, this.changeDirectorySequence_));
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment