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

Unified Diff: chrome/browser/resources/file_manager/js/volume_manager.js

Issue 10824110: Fixed race condition on mounting dgrive while file manager initialization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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: chrome/browser/resources/file_manager/js/volume_manager.js
diff --git a/chrome/browser/resources/file_manager/js/volume_manager.js b/chrome/browser/resources/file_manager/js/volume_manager.js
index 0a95574cc48fa4a95d090a5f3cec4728fd0fccec..fd9f0a94191215bd3f163913f491049779f493dc 100644
--- a/chrome/browser/resources/file_manager/js/volume_manager.js
+++ b/chrome/browser/resources/file_manager/js/volume_manager.js
@@ -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 +
« 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