| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 /// Applies this transform. | 214 /// Applies this transform. |
| 215 void _apply() { | 215 void _apply() { |
| 216 assert(!_onAssetController.isClosed); | 216 assert(!_onAssetController.isClosed); |
| 217 | 217 |
| 218 // Clear input subscriptions here as well as in [_process] because [_apply] | 218 // Clear input subscriptions here as well as in [_process] because [_apply] |
| 219 // may be restarted independently if only a secondary input changes. | 219 // may be restarted independently if only a secondary input changes. |
| 220 _clearInputSubscriptions(); | 220 _clearInputSubscriptions(); |
| 221 _state = _TransformNodeState.PROCESSING; | 221 _state = _TransformNodeState.PROCESSING; |
| 222 primary.whenAvailable((_) { | 222 primary.whenAvailable((_) { |
| 223 if (_state.needsIsPrimary) return; | 223 if (_state.needsIsPrimary) return null; |
| 224 _state = _TransformNodeState.PROCESSING; | 224 _state = _TransformNodeState.PROCESSING; |
| 225 // TODO(nweiz): If [transformer] is a [DeclaringTransformer] but not a | 225 // TODO(nweiz): If [transformer] is a [DeclaringTransformer] but not a |
| 226 // [LazyTransformer], we can get some mileage out of doing a declarative | 226 // [LazyTransformer], we can get some mileage out of doing a declarative |
| 227 // first so we know how to hook up the assets. | 227 // first so we know how to hook up the assets. |
| 228 if (_isLazy) return _declareLazy(); | 228 if (_isLazy) return _declareLazy(); |
| 229 return _applyImmediate(); | 229 return _applyImmediate(); |
| 230 }).catchError((error, stackTrace) { | 230 }).catchError((error, stackTrace) { |
| 231 // If the transform became dirty while processing, ignore any errors from | 231 // If the transform became dirty while processing, ignore any errors from |
| 232 // it. | 232 // it. |
| 233 if (!_state.isProcessing || _isRemoved) return; | 233 if (!_state.isProcessing || _isRemoved) return; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 /// | 483 /// |
| 484 /// Specifically, whether [this] is [APPLIED] or [NOT_PRIMARY]. | 484 /// Specifically, whether [this] is [APPLIED] or [NOT_PRIMARY]. |
| 485 bool get isDone => isApplied || isNotPrimary; | 485 bool get isDone => isApplied || isNotPrimary; |
| 486 | 486 |
| 487 final String name; | 487 final String name; |
| 488 | 488 |
| 489 const _TransformNodeState._(this.name); | 489 const _TransformNodeState._(this.name); |
| 490 | 490 |
| 491 String toString() => name; | 491 String toString() => name; |
| 492 } | 492 } |
| OLD | NEW |