| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @constructor | 6 * @constructor |
| 7 * @class FunctionSequence to invoke steps in sequence | 7 * @class FunctionSequence to invoke steps in sequence |
| 8 * | 8 * |
| 9 * @param steps array of functions to invoke in parallel | 9 * @param steps array of functions to invoke in parallel |
| 10 * @param callback callback to invoke on success | 10 * @param callback callback to invoke on success |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 * at once | 56 * at once |
| 57 */ | 57 */ |
| 58 FunctionParallel.prototype.start = function(var_args) { | 58 FunctionParallel.prototype.start = function(var_args) { |
| 59 this.logger.vlog('Starting [' + this.steps_.length + '] parallel tasks with ' | 59 this.logger.vlog('Starting [' + this.steps_.length + '] parallel tasks with ' |
| 60 + arguments.length + ' argument(s)'); | 60 + arguments.length + ' argument(s)'); |
| 61 if (this.logger.verbose) { | 61 if (this.logger.verbose) { |
| 62 for (var j = 0; j < arguments.length; j++) { | 62 for (var j = 0; j < arguments.length; j++) { |
| 63 this.logger.vlog(arguments[j]); | 63 this.logger.vlog(arguments[j]); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 for (var i=0; i < this.steps_.length; i++) { | 66 for (var i = 0; i < this.steps_.length; i++) { |
| 67 this.logger.vlog('Attempting to start step [' + this.steps_[i].name + ']'); | 67 this.logger.vlog('Attempting to start step [' + this.steps_[i].name + ']'); |
| 68 try { | 68 try { |
| 69 this.steps_[i].apply(this, arguments); | 69 this.steps_[i].apply(this, arguments); |
| 70 } catch(e) { | 70 } catch (e) { |
| 71 this.onError(e.toString()); | 71 this.onError(e.toString()); |
| 72 } | 72 } |
| 73 } | 73 } |
| 74 }; | 74 }; |
| OLD | NEW |