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.transform_node; | 5 library barback.transform_node; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'asset.dart'; | 9 import 'asset.dart'; |
10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 184 |
185 /// Determines whether [primary] is primary for [transformer], and if so runs | 185 /// Determines whether [primary] is primary for [transformer], and if so runs |
186 /// [transformer.apply]. | 186 /// [transformer.apply]. |
187 void _process() { | 187 void _process() { |
188 // Clear all the old input subscriptions. If an input is re-used, we'll | 188 // Clear all the old input subscriptions. If an input is re-used, we'll |
189 // re-subscribe. | 189 // re-subscribe. |
190 _clearInputSubscriptions(); | 190 _clearInputSubscriptions(); |
191 _state = _TransformNodeState.PROCESSING; | 191 _state = _TransformNodeState.PROCESSING; |
192 primary.whenAvailable((_) { | 192 primary.whenAvailable((_) { |
193 _state = _TransformNodeState.PROCESSING; | 193 _state = _TransformNodeState.PROCESSING; |
194 return transformer.isPrimary(primary.asset); | 194 return transformer.isPrimary(primary.asset.id); |
195 }).catchError((error, stackTrace) { | 195 }).catchError((error, stackTrace) { |
196 // If the transform became dirty while processing, ignore any errors from | 196 // If the transform became dirty while processing, ignore any errors from |
197 // it. | 197 // it. |
198 if (_state.needsIsPrimary || _isRemoved) return false; | 198 if (_state.needsIsPrimary || _isRemoved) return false; |
199 | 199 |
200 // Catch all transformer errors and pipe them to the results stream. This | 200 // Catch all transformer errors and pipe them to the results stream. This |
201 // is so a broken transformer doesn't take down the whole graph. | 201 // is so a broken transformer doesn't take down the whole graph. |
202 phase.cascade.reportError(_wrapException(error, stackTrace)); | 202 phase.cascade.reportError(_wrapException(error, stackTrace)); |
203 | 203 |
204 return false; | 204 return false; |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 /// | 506 /// |
507 /// Specifically, whether [this] is [APPLIED] or [NOT_PRIMARY]. | 507 /// Specifically, whether [this] is [APPLIED] or [NOT_PRIMARY]. |
508 bool get isDone => isApplied || isNotPrimary; | 508 bool get isDone => isApplied || isNotPrimary; |
509 | 509 |
510 final String name; | 510 final String name; |
511 | 511 |
512 const _TransformNodeState._(this.name); | 512 const _TransformNodeState._(this.name); |
513 | 513 |
514 String toString() => name; | 514 String toString() => name; |
515 } | 515 } |
OLD | NEW |