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

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

Issue 149243009: Add support for lazy transformers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 10 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 | « pkg/barback/lib/src/phase.dart ('k') | pkg/barback/lib/src/transform.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.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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 _newPassThrough = true; 143 _newPassThrough = true;
144 } 144 }
145 145
146 var brandNewTransformers = newTransformers.difference(oldTransformers); 146 var brandNewTransformers = newTransformers.difference(oldTransformers);
147 if (brandNewTransformers.isEmpty) return; 147 if (brandNewTransformers.isEmpty) return;
148 148
149 brandNewTransformers.forEach(_transformers.add); 149 brandNewTransformers.forEach(_transformers.add);
150 if (_adjustTransformersFuture == null) _adjustTransformers(); 150 if (_adjustTransformersFuture == null) _adjustTransformers();
151 } 151 }
152 152
153 /// Force all [LazyTransformer]s' transforms in this input to begin producing
154 /// concrete assets.
155 void forceAllTransforms() {
156 for (var transform in _transforms) {
157 transform.force();
158 }
159 }
160
153 /// Asynchronously determines which transformers can consume [input] as a 161 /// Asynchronously determines which transformers can consume [input] as a
154 /// primary input and creates transforms for them. 162 /// primary input and creates transforms for them.
155 /// 163 ///
156 /// This ensures that if [input] is modified or removed during or after the 164 /// This ensures that if [input] is modified or removed during or after the
157 /// time it takes to adjust its transformers, they're appropriately 165 /// time it takes to adjust its transformers, they're appropriately
158 /// re-adjusted. Its progress can be tracked in [_adjustTransformersFuture]. 166 /// re-adjusted. Its progress can be tracked in [_adjustTransformersFuture].
159 void _adjustTransformers() { 167 void _adjustTransformers() {
160 // Mark the input as dirty. This may not actually end up creating any new 168 // Mark the input as dirty. This may not actually end up creating any new
161 // transforms, but we want adding or removing a source asset to consistently 169 // transforms, but we want adding or removing a source asset to consistently
162 // kick off a build, even if that build does nothing. 170 // kick off a build, even if that build does nothing.
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 } 321 }
314 322
315 return Future.wait(_transforms.map((transform) { 323 return Future.wait(_transforms.map((transform) {
316 if (!transform.isDirty) return new Future.value(new Set()); 324 if (!transform.isDirty) return new Future.value(new Set());
317 return transform.apply(); 325 return transform.apply();
318 })).then((outputs) => unionAll(outputs)); 326 })).then((outputs) => unionAll(outputs));
319 } 327 }
320 328
321 String toString() => "phase input in $_location for $input"; 329 String toString() => "phase input in $_location for $input";
322 } 330 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/phase.dart ('k') | pkg/barback/lib/src/transform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698