| Index: ui/file_manager/file_manager/background/js/task_queue.js
|
| diff --git a/ui/file_manager/file_manager/background/js/task_queue.js b/ui/file_manager/file_manager/background/js/task_queue.js
|
| index 43ebb70b4b0e8290b301ee14991fd1e9f29bc882..9f2d539432627cd9e7ca58dd39a8552ca4f93b7f 100644
|
| --- a/ui/file_manager/file_manager/background/js/task_queue.js
|
| +++ b/ui/file_manager/file_manager/background/js/task_queue.js
|
| @@ -52,7 +52,7 @@ importer.TaskQueue.prototype.queueTask = function(task) {
|
| // The Tasks that are pushed onto the queue aren't required to be inherently
|
| // asynchronous. This code force task execution to occur asynchronously.
|
| Promise.resolve().then(function() {
|
| - task.addObserver(this.onTaskUpdate_.bind(this));
|
| + task.addObserver(this.onTaskUpdate_.bind(this, task));
|
| this.tasks_.push(task);
|
| // If more than one task is queued, then the queue is already running.
|
| if (this.tasks_.length === 1) {
|
| @@ -91,11 +91,11 @@ importer.TaskQueue.prototype.setIdleCallback = function(callback) {
|
| /**
|
| * Sends out notifications when a task updates. This is meant to be called by
|
| * the running tasks owned by this queue.
|
| - * @param {!importer.TaskQueue.UpdateType} updateType
|
| * @param {!importer.TaskQueue.Task} task
|
| + * @param {!importer.TaskQueue.UpdateType} updateType
|
| * @private
|
| */
|
| -importer.TaskQueue.prototype.onTaskUpdate_ = function(updateType, task) {
|
| +importer.TaskQueue.prototype.onTaskUpdate_ = function(task, updateType) {
|
| // Send a task update to clients.
|
| this.updateCallbacks_.forEach(function(callback) {
|
| callback.call(null, updateType, task);
|
| @@ -146,7 +146,13 @@ importer.TaskQueue.prototype.runPending_ = function() {
|
| importer.TaskQueue.Task = function() {};
|
|
|
| /**
|
| - * @typedef {function(!importer.TaskQueue.UpdateType, !importer.TaskQueue.Task)}
|
| + * A callback that is triggered whenever an update is reported on the observed
|
| + * task. The first argument is a string specifying the type of the update.
|
| + * Standard values used by all tasks are enumerated in
|
| + * importer.TaskQueue.UpdateType, but child classes may add supplementary update
|
| + * types of their own. The second argument is an Object containing
|
| + * supplementary information pertaining to the update.
|
| + * @typedef {function(string, Object=)}
|
| */
|
| importer.TaskQueue.Task.Observer;
|
|
|
| @@ -196,13 +202,14 @@ importer.TaskQueue.BaseTask.prototype.addObserver = function(observer) {
|
| importer.TaskQueue.BaseTask.prototype.run = function() {};
|
|
|
| /**
|
| - * @param {!importer.TaskQueue.UpdateType} updateType
|
| + * @param {string} updateType
|
| + * @param {Object=} opt_data
|
| * @protected
|
| */
|
| -importer.TaskQueue.BaseTask.prototype.notify = function(updateType) {
|
| +importer.TaskQueue.BaseTask.prototype.notify = function(updateType, opt_data) {
|
| this.observers_.forEach(
|
| /** @param {!importer.TaskQueue.Task.Observer} callback */
|
| function(callback) {
|
| - callback.call(null, updateType, this);
|
| + callback.call(null, updateType, opt_data);
|
| }.bind(this));
|
| };
|
|
|