Chromium Code Reviews| 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.phase_input; | 5 library barback.phase_input; |
| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 if (error is! AssetNotFoundException || error.id != input.id) { | 186 if (error is! AssetNotFoundException || error.id != input.id) { |
| 187 throw error; | 187 throw error; |
| 188 } | 188 } |
| 189 | 189 |
| 190 // If the asset is removed, [_tryUntilStable] will throw an | 190 // If the asset is removed, [_tryUntilStable] will throw an |
| 191 // [AssetNotFoundException]. In that case, just remove it. | 191 // [AssetNotFoundException]. In that case, just remove it. |
| 192 remove(); | 192 remove(); |
| 193 }).whenComplete(() { | 193 }).whenComplete(() { |
| 194 _adjustTransformersFuture = null; | 194 _adjustTransformersFuture = null; |
| 195 }); | 195 }); |
| 196 | |
| 197 // Don't top-level errors coming from the input processing. Any errors will | |
| 198 // eventually be piped through [process]'s returned Future. | |
| 199 _adjustTransformersFuture.catchError((_) {}); | |
| 200 } | 196 } |
| 201 | 197 |
| 202 // Remove any old transforms that used to have [asset] as a primary asset but | 198 // Remove any old transforms that used to have [asset] as a primary asset but |
| 203 // no longer apply to its new contents. | 199 // no longer apply to its new contents. |
| 204 Future _removeStaleTransforms(Asset asset, Set<Transformer> transformers) { | 200 Future _removeStaleTransforms(Asset asset, Set<Transformer> transformers) { |
| 205 return Future.wait(_transforms.map((transform) { | 201 return Future.wait(_transforms.map((transform) { |
| 206 return newFuture(() { | 202 return newFuture(() { |
| 207 if (!transformers.contains(transform.transformer)) return false; | 203 if (!transformers.contains(transform.transformer)) return false; |
| 208 | 204 |
| 209 // TODO(rnystrom): Catch all errors from isPrimary() and redirect to | 205 // TODO(rnystrom): Catch all errors from isPrimary() and redirect to |
| 210 // results (issue 16162). | 206 // results (issue 16162). |
|
Bob Nystrom
2014/03/04 23:52:40
Is this TODO still relevant?
nweiz
2014/03/05 00:11:58
Yes; these still need to be wrapped as BarbackExce
| |
| 211 return transform.transformer.isPrimary(asset); | 207 return transform.transformer.isPrimary(asset); |
| 212 }).then((isPrimary) { | 208 }).then((isPrimary) { |
| 213 if (isPrimary) return; | 209 if (isPrimary) return; |
| 214 _transforms.remove(transform); | 210 _transforms.remove(transform); |
| 215 transform.remove(); | 211 transform.remove(); |
| 216 }); | 212 }); |
| 217 })); | 213 })); |
| 218 } | 214 } |
| 219 | 215 |
| 220 // Add new transforms for transformers that consider [input]'s asset to be a | 216 // Add new transforms for transformers that consider [input]'s asset to be a |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 321 } | 317 } |
| 322 | 318 |
| 323 return Future.wait(_transforms.map((transform) { | 319 return Future.wait(_transforms.map((transform) { |
| 324 if (!transform.isDirty) return new Future.value(new Set()); | 320 if (!transform.isDirty) return new Future.value(new Set()); |
| 325 return transform.apply(); | 321 return transform.apply(); |
| 326 })).then((outputs) => unionAll(outputs)); | 322 })).then((outputs) => unionAll(outputs)); |
| 327 } | 323 } |
| 328 | 324 |
| 329 String toString() => "phase input in $_location for $input"; | 325 String toString() => "phase input in $_location for $input"; |
| 330 } | 326 } |
| OLD | NEW |