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 {string} name //TODO(JSDOC). | 9 * @param {string} name //TODO(JSDOC). |
10 * @param {Array} steps array of functions to invoke in sequence. | 10 * @param {Array} steps array of functions to invoke in sequence. |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 */ | 44 */ |
45 FunctionSequence.prototype.setFailureCallback = function(failureCallback) { | 45 FunctionSequence.prototype.setFailureCallback = function(failureCallback) { |
46 this.failureCallback_ = failureCallback; | 46 this.failureCallback_ = failureCallback; |
47 }; | 47 }; |
48 | 48 |
49 | 49 |
50 /** | 50 /** |
51 * Error handling function, which traces current error step, stops sequence | 51 * Error handling function, which traces current error step, stops sequence |
52 * advancing and fires error callback. | 52 * advancing and fires error callback. |
53 * | 53 * |
| 54 * @param {string} err Error message |
54 * @private | 55 * @private |
55 * @param err error message. | |
56 */ | 56 */ |
57 FunctionSequence.prototype.onError_ = function(err) { | 57 FunctionSequence.prototype.onError_ = function(err) { |
58 this.logger.vlog('Failed step: ' + this.steps_[this.currentStepIdx_].name + | 58 this.logger.vlog('Failed step: ' + this.steps_[this.currentStepIdx_].name + |
59 ': ' + err); | 59 ': ' + err); |
60 if (!this.failed_) { | 60 if (!this.failed_) { |
61 this.failed_ = true; | 61 this.failed_ = true; |
62 this.failureCallback_(err); | 62 this.failureCallback_(err); |
63 } | 63 } |
64 }; | 64 }; |
65 | 65 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 /** | 123 /** |
124 * Add Function object mimics to FunctionSequence | 124 * Add Function object mimics to FunctionSequence |
125 * @private | 125 * @private |
126 * @param {*} obj //TODO(JSDOC). | 126 * @param {*} obj //TODO(JSDOC). |
127 * @param {Array.*} args /TODO(JSDOC). | 127 * @param {Array.*} args /TODO(JSDOC). |
128 */ | 128 */ |
129 FunctionSequence.prototype.apply_ = function(obj, args) { | 129 FunctionSequence.prototype.apply_ = function(obj, args) { |
130 this.start.apply(this, args); | 130 this.start.apply(this, args); |
131 }; | 131 }; |
OLD | NEW |