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

Side by Side Diff: chrome/browser/resources/file_manager/js/metadata/function_parallel.js

Issue 12262003: [Cleanup] Files.app: Adds missing periods at the end of the descriptions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.
11 * @param failureCallback callback to invoke on failure 11 * @param failureCallback callback to invoke on failure.
12 */ 12 */
13 function FunctionParallel(name, steps, logger, callback, failureCallback) { 13 function FunctionParallel(name, steps, logger, callback, failureCallback) {
14 // Private variables hidden in closure 14 // Private variables hidden in closure
15 this.currentStepIdx_ = -1; 15 this.currentStepIdx_ = -1;
16 this.failed_ = false; 16 this.failed_ = false;
17 this.steps_ = steps; 17 this.steps_ = steps;
18 this.callback_ = callback; 18 this.callback_ = callback;
19 this.failureCallback_ = failureCallback; 19 this.failureCallback_ = failureCallback;
20 this.logger = logger; 20 this.logger = logger;
21 this.name = name; 21 this.name = name;
22 22
23 this.remaining = this.steps_.length; 23 this.remaining = this.steps_.length;
24 24
25 this.nextStep = this.nextStep_.bind(this); 25 this.nextStep = this.nextStep_.bind(this);
26 this.onError = this.onError_.bind(this); 26 this.onError = this.onError_.bind(this);
27 this.apply = this.start.bind(this); 27 this.apply = this.start.bind(this);
28 } 28 }
29 29
30 30
31 /** 31 /**
32 * Error handling function, which fires error callback. 32 * Error handling function, which fires error callback.
33 * 33 *
34 * @param err error message 34 * @param err error message.
35 */ 35 */
36 FunctionParallel.prototype.onError_ = function(err) { 36 FunctionParallel.prototype.onError_ = function(err) {
37 if (!this.failed_) { 37 if (!this.failed_) {
38 this.failed_ = true; 38 this.failed_ = true;
39 this.failureCallback_(err); 39 this.failureCallback_(err);
40 } 40 }
41 }; 41 };
42 42
43 /** 43 /**
44 * Advances to next step. This method should not be used externally. In external 44 * Advances to next step. This method should not be used externally. In external
(...skipping 20 matching lines...) Expand all
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 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698