Commit e037cd16 authored by serya@chromium.org's avatar serya@chromium.org

Fixed race condition on mounting dgrive while file manager initialization.

BUG=139680
TEST=Manual test.


Review URL: https://chromiumcodereview.appspot.com/10824110

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149209 0039d316-1c4b-4281-b951-d872f2087c98
parent f522a1e5
......@@ -115,6 +115,7 @@ VolumeManager.prototype.initMountPoints_ = function() {
var mountedVolumes = [];
var self = this;
var index = 0;
this.deferredQueue_ = [];
function step(mountPoints) {
if (index < mountPoints.length) {
var info = mountPoints[index];
......@@ -137,6 +138,12 @@ VolumeManager.prototype.initMountPoints_ = function() {
chrome.fileBrowserPrivate.onMountCompleted.addListener(
self.onMountCompleted_.bind(self));
var deferredQueue = self.deferredQueue_;
self.deferredQueue_ = null;
for (var i = 0; i < deferredQueue.length; i++) {
deferredQueue[i]();
}
if (mountedVolumes.length > 0)
cr.dispatchSimpleEvent(self, 'change');
}
......@@ -302,6 +309,12 @@ VolumeManager.prototype.unmount = function(mountPath,
successCallback,
errorCallback) {
this.validateMountPath_(mountPath);
if (this.deferredQueue_) {
this.deferredQueue_.push(this.unmount.bind(this,
mountPath, successCallback, errorCallback));
return;
}
var volumeInfo = this.mountedVolumes_[mountPath];
if (!volumeInfo) {
errorCallback(VolumeManager.Error.NOT_MOUNTED);
......@@ -370,6 +383,12 @@ VolumeManager.prototype.getVolumeInfo_ = function(mountPath) {
*/
VolumeManager.prototype.mount_ = function(url, mountType,
successCallback, errorCallback) {
if (this.deferredQueue_) {
this.deferredQueue_.push(this.mount_.bind(this,
url, mountType, successCallback, errorCallback));
return;
}
chrome.fileBrowserPrivate.addMount(url, mountType, {},
function(sourcePath) {
console.log('Mount request: url=' + url + '; mountType=' + mountType +
......
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