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

Unified Diff: ui/file_manager/file_manager/foreground/js/metadata/function_parallel.js

Issue 645853013: Remove some platform specific stuff from views. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 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
Index: ui/file_manager/file_manager/foreground/js/metadata/function_parallel.js
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/function_parallel.js b/ui/file_manager/file_manager/foreground/js/metadata/function_parallel.js
deleted file mode 100644
index 719343b62fc7ecedf1f3b4f9b4be7d865ea8c91c..0000000000000000000000000000000000000000
--- a/ui/file_manager/file_manager/foreground/js/metadata/function_parallel.js
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-'use strict';
-
-/**
- * @class FunctionSequence to invoke steps in sequence
- *
- * @param {string} name Name of the function.
- * @param {Array.<function>} steps Array of functions to invoke in parallel.
- * @param {Object} logger Logger object.
- * @param {function()} callback Callback to invoke on success.
- * @param {function(string)} failureCallback Callback to invoke on failure.
- * @constructor
- */
-function FunctionParallel(name, steps, logger, callback, failureCallback) {
- // Private variables hidden in closure
- this.currentStepIdx_ = -1;
- this.failed_ = false;
- this.steps_ = steps;
- this.callback_ = callback;
- this.failureCallback_ = failureCallback;
- this.logger = logger;
- this.name = name;
-
- this.remaining = this.steps_.length;
-
- this.nextStep = this.nextStep_.bind(this);
- this.onError = this.onError_.bind(this);
- this.apply = this.start.bind(this);
-}
-
-
-/**
- * Error handling function, which fires error callback.
- *
- * @param {string} err Error message.
- * @private
- */
-FunctionParallel.prototype.onError_ = function(err) {
- if (!this.failed_) {
- this.failed_ = true;
- this.failureCallback_(err);
- }
-};
-
-/**
- * Advances to next step. This method should not be used externally. In external
- * cases should be used nextStep function, which is defined in closure and thus
- * has access to internal variables of functionsequence.
- *
- * @private
- */
-FunctionParallel.prototype.nextStep_ = function() {
- if (--this.remaining == 0 && !this.failed_) {
- this.callback_();
- }
-};
-
-/**
- * This function should be called only once on start, so start all the children
- * at once
- * @param {...} var_args Arguments to be passed to all the steps.
- */
-FunctionParallel.prototype.start = function(var_args) {
- this.logger.vlog('Starting [' + this.steps_.length + '] parallel tasks ' +
- 'with ' + arguments.length + ' argument(s)');
- if (this.logger.verbose) {
- for (var j = 0; j < arguments.length; j++) {
- this.logger.vlog(arguments[j]);
- }
- }
- for (var i = 0; i < this.steps_.length; i++) {
- this.logger.vlog('Attempting to start step [' + this.steps_[i].name + ']');
- try {
- this.steps_[i].apply(this, arguments);
- } catch (e) {
- this.onError(e.toString());
- }
- }
-};

Powered by Google App Engine
This is Rietveld 408576698