OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 barback.asset_cascade; | 5 library barback.asset_cascade; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'asset.dart'; | 10 import 'asset.dart'; |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // Process that phase and then loop onto the next. | 216 // Process that phase and then loop onto the next. |
217 return future.then((_) => _process()); | 217 return future.then((_) => _process()); |
218 }); | 218 }); |
219 } | 219 } |
220 | 220 |
221 /// Processes the current batch of changes to source assets. | 221 /// Processes the current batch of changes to source assets. |
222 Future _processSourceChanges() { | 222 Future _processSourceChanges() { |
223 // Always pump the event loop. This ensures a bunch of synchronous source | 223 // Always pump the event loop. This ensures a bunch of synchronous source |
224 // changes are processed in a single batch even when the first one starts | 224 // changes are processed in a single batch even when the first one starts |
225 // the build process. | 225 // the build process. |
226 return new Future(() { | 226 return newFuture(() { |
227 if (_sourceChanges == null) return null; | 227 if (_sourceChanges == null) return null; |
228 | 228 |
229 // Take the current batch to ensure it doesn't get added to while we're | 229 // Take the current batch to ensure it doesn't get added to while we're |
230 // processing it. | 230 // processing it. |
231 var changes = _sourceChanges; | 231 var changes = _sourceChanges; |
232 _sourceChanges = null; | 232 _sourceChanges = null; |
233 | 233 |
234 var updated = new AssetSet(); | 234 var updated = new AssetSet(); |
235 var futures = []; | 235 var futures = []; |
236 for (var id in changes.updated) { | 236 for (var id in changes.updated) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 msg.write(prefixLines(error.toString())); | 287 msg.write(prefixLines(error.toString())); |
288 if (stackTrace != null) { | 288 if (stackTrace != null) { |
289 msg.write("\n\n"); | 289 msg.write("\n\n"); |
290 msg.write("Stack trace:\n"); | 290 msg.write("Stack trace:\n"); |
291 msg.write(prefixLines(stackTrace.toString())); | 291 msg.write(prefixLines(stackTrace.toString())); |
292 } | 292 } |
293 return msg.toString(); | 293 return msg.toString(); |
294 }).join("\n\n"); | 294 }).join("\n\n"); |
295 } | 295 } |
296 } | 296 } |
OLD | NEW |