Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Side by Side Diff: pkg/barback/lib/src/transform_node.dart

Issue 238513002: Lazy transformers followed by non-lazy ones shouldn't always be forced. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/barback/test/package_graph/lazy_transformer_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 TransformNode(this.phase, Transformer transformer, AssetNode primary, 132 TransformNode(this.phase, Transformer transformer, AssetNode primary,
133 this._location) 133 this._location)
134 : transformer = transformer, 134 : transformer = transformer,
135 primary = primary, 135 primary = primary,
136 deferred = transformer is LazyTransformer || 136 deferred = transformer is LazyTransformer ||
137 (transformer is DeclaringTransformer && primary.deferred) { 137 (transformer is DeclaringTransformer && primary.deferred) {
138 _awaitingForce = deferred; 138 _awaitingForce = deferred;
139 139
140 _onLogPool.add(_onLogController.stream); 140 _onLogPool.add(_onLogController.stream);
141 141
142 if (!deferred) primary.force();
143
144 _primarySubscription = primary.onStateChange.listen((state) { 142 _primarySubscription = primary.onStateChange.listen((state) {
145 if (state.isRemoved) { 143 if (state.isRemoved) {
146 remove(); 144 remove();
147 } else { 145 } else {
148 if (state.isDirty && !deferred) primary.force(); 146 if (state.isDirty && !deferred) primary.force();
149 _dirty(); 147 _dirty();
150 } 148 }
151 }); 149 });
152 150
153 _phaseSubscription = phase.previous.onAsset.listen((node) { 151 _phaseSubscription = phase.previous.onAsset.listen((node) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (_isRemoved) return false; 244 if (_isRemoved) return false;
247 245
248 // Catch all transformer errors and pipe them to the results stream. This 246 // Catch all transformer errors and pipe them to the results stream. This
249 // is so a broken transformer doesn't take down the whole graph. 247 // is so a broken transformer doesn't take down the whole graph.
250 phase.cascade.reportError(_wrapException(error, stackTrace)); 248 phase.cascade.reportError(_wrapException(error, stackTrace));
251 249
252 return false; 250 return false;
253 }).then((isPrimary) { 251 }).then((isPrimary) {
254 if (_isRemoved) return null; 252 if (_isRemoved) return null;
255 if (isPrimary) { 253 if (isPrimary) {
254 if (!deferred) primary.force();
256 return _declareOutputs().then((_) { 255 return _declareOutputs().then((_) {
257 if (_isRemoved) return; 256 if (_isRemoved) return;
258 if (_awaitingForce) { 257 if (_awaitingForce) {
259 _state = _State.DECLARED; 258 _state = _State.DECLARED;
260 _onDoneController.add(null); 259 _onDoneController.add(null);
261 } else { 260 } else {
262 _apply(); 261 _apply();
263 } 262 }
264 }); 263 });
265 } 264 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 /// 556 ///
558 /// This will never transition to another state. 557 /// This will never transition to another state.
559 static final NOT_PRIMARY = const _State._("not primary"); 558 static final NOT_PRIMARY = const _State._("not primary");
560 559
561 final String name; 560 final String name;
562 561
563 const _State._(this.name); 562 const _State._(this.name);
564 563
565 String toString() => name; 564 String toString() => name;
566 } 565 }
OLDNEW
« no previous file with comments | « no previous file | pkg/barback/test/package_graph/lazy_transformer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698