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

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

Issue 9583009: [File Manager] Cleanup: Moving js/css/html files to dedicated directories (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2011->2012 Created 8 years, 10 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: chrome/browser/resources/file_manager/js/function_parallel.js
diff --git a/chrome/browser/resources/file_manager/js/function_parallel.js b/chrome/browser/resources/file_manager/js/function_parallel.js
deleted file mode 100644
index a2925ac93019cf087aa3d5d8212c83e0ed47bc01..0000000000000000000000000000000000000000
--- a/chrome/browser/resources/file_manager/js/function_parallel.js
+++ /dev/null
@@ -1,74 +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.
-
-/**
- * @constructor
- * @class FunctionSequence to invoke steps in sequence
- *
- * @param steps array of functions to invoke in parallel
- * @param callback callback to invoke on success
- * @param failureCallback callback to invoke on failure
- */
-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 err error message
- */
-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.
- */
-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
- */
-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