OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library test.util.compiler_pool; | 5 library test.util.compiler_pool; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 23 matching lines...) Loading... |
34 /// have already exited; they're kept around so that their output can be | 34 /// have already exited; they're kept around so that their output can be |
35 /// emitted once they become visible. | 35 /// emitted once they become visible. |
36 final _compilers = new Queue<_Compiler>(); | 36 final _compilers = new Queue<_Compiler>(); |
37 | 37 |
38 /// Whether [close] has been called. | 38 /// Whether [close] has been called. |
39 bool get _closed => _closeCompleter != null; | 39 bool get _closed => _closeCompleter != null; |
40 | 40 |
41 /// The completer for the [Future] returned by [close]. | 41 /// The completer for the [Future] returned by [close]. |
42 Completer _closeCompleter; | 42 Completer _closeCompleter; |
43 | 43 |
44 /// Creates a compiler pool that runs up to [parallel] instances of `dart2js` | 44 /// Creates a compiler pool that runs up to [concurrency] instances of |
45 /// at once. | 45 /// `dart2js` at once. |
46 /// | 46 /// |
47 /// If [parallel] isn't provided, it defaults to 4. | 47 /// If [concurrency] isn't provided, it defaults to 4. |
48 /// | 48 /// |
49 /// If [color] is true, `dart2js` will be run with colors enabled. | 49 /// If [color] is true, `dart2js` will be run with colors enabled. |
50 CompilerPool({int parallel, bool color: false}) | 50 CompilerPool({int concurrency, bool color: false}) |
51 : _pool = new Pool(parallel == null ? 4 : parallel), | 51 : _pool = new Pool(concurrency == null ? 4 : concurrency), |
52 _color = color; | 52 _color = color; |
53 | 53 |
54 /// Compile the Dart code at [dartPath] to [jsPath]. | 54 /// Compile the Dart code at [dartPath] to [jsPath]. |
55 /// | 55 /// |
56 /// This wraps the Dart code in the standard browser-testing wrapper. If | 56 /// This wraps the Dart code in the standard browser-testing wrapper. If |
57 /// [packageRoot] is provided, it's used as the package root for the | 57 /// [packageRoot] is provided, it's used as the package root for the |
58 /// compilation. | 58 /// compilation. |
59 /// | 59 /// |
60 /// The returned [Future] will complete once the `dart2js` process completes | 60 /// The returned [Future] will complete once the `dart2js` process completes |
61 /// *and* all its output has been printed to the command line. | 61 /// *and* all its output has been printed to the command line. |
(...skipping 99 matching lines...) Loading... |
161 /// The underlying process. | 161 /// The underlying process. |
162 final Process process; | 162 final Process process; |
163 | 163 |
164 /// A future that will complete once this instance has finished running and | 164 /// A future that will complete once this instance has finished running and |
165 /// all its output has been printed. | 165 /// all its output has been printed. |
166 Future get onDone => onDoneCompleter.future; | 166 Future get onDone => onDoneCompleter.future; |
167 final onDoneCompleter = new Completer(); | 167 final onDoneCompleter = new Completer(); |
168 | 168 |
169 _Compiler(this.path, this.process); | 169 _Compiler(this.path, this.process); |
170 } | 170 } |
OLD | NEW |