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

Side by Side Diff: packages/barback/lib/src/transformer/declaring_transform.dart

Issue 3015713002: Roll to pickup pool changes
Patch Set: Created 3 years, 2 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.transformer.declaring_transform; 5 library barback.transformer.declaring_transform;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import '../asset/asset_id.dart'; 9 import '../asset/asset_id.dart';
10 import 'declaring_aggregate_transform.dart'; 10 import 'declaring_aggregate_transform.dart';
11 import 'transform_logger.dart'; 11 import 'transform_logger.dart';
12 12
13 /// Creates a new [DeclaringTransform] wrapping an 13 /// Creates a new [DeclaringTransform] wrapping an
14 /// [AggregateDeclaringTransform]. 14 /// [AggregateDeclaringTransform].
15 /// 15 ///
16 /// Although barback internally works in terms of 16 /// Although barback internally works in terms of
17 /// [DeclaringAggregateTransformer]s, most transformers only work on individual 17 /// [DeclaringAggregateTransformer]s, most transformers only work on individual
18 /// primary inputs in isolation. We want to allow those transformers to 18 /// primary inputs in isolation. We want to allow those transformers to
19 /// implement the more user-friendly [DeclaringTransformer] interface which 19 /// implement the more user-friendly [DeclaringTransformer] interface which
20 /// takes the more user-friendly [DeclaringTransform] object. This method wraps 20 /// takes the more user-friendly [DeclaringTransform] object. This method wraps
21 /// the more general [DeclaringAggregateTransform] to return a 21 /// the more general [DeclaringAggregateTransform] to return a
22 /// [DeclaringTransform] instead. 22 /// [DeclaringTransform] instead.
23 Future<DeclaringTransform> newDeclaringTransform( 23 Future<DeclaringTransform> newDeclaringTransform(
24 DeclaringAggregateTransform aggregate) { 24 DeclaringAggregateTransform aggregate) {
25 // A wrapped [Transformer] will assign each primary input a unique transform 25 // A wrapped [Transformer] will assign each primary input a unique transform
26 // key, so we can safely get the first asset emitted. We don't want to wait 26 // key, so we can safely get the first asset emitted. We don't want to wait
27 // for the stream to close, since that requires barback to prove that no more 27 // for the stream to close, since that requires barback to prove that no more
28 // new assets will be generated. 28 // new assets will be generated.
29 return aggregate.primaryIds.first.then((primaryId) => 29 return aggregate.primaryIds.first
30 new DeclaringTransform._(aggregate, primaryId)); 30 .then((primaryId) => new DeclaringTransform._(aggregate, primaryId));
31 } 31 }
32 32
33 /// A transform for [DeclaringTransformer]s that allows them to declare the ids 33 /// A transform for [DeclaringTransformer]s that allows them to declare the ids
34 /// of the outputs they'll generate without generating the concrete bodies of 34 /// of the outputs they'll generate without generating the concrete bodies of
35 /// those outputs. 35 /// those outputs.
36 class DeclaringTransform { 36 class DeclaringTransform {
37 /// The underlying aggregate transform. 37 /// The underlying aggregate transform.
38 final DeclaringAggregateTransform _aggregate; 38 final DeclaringAggregateTransform _aggregate;
39 39
40 final AssetId primaryId; 40 final AssetId primaryId;
(...skipping 14 matching lines...) Expand all
55 55
56 /// Consume the primary input so that it doesn't get processed by future 56 /// Consume the primary input so that it doesn't get processed by future
57 /// phases or emitted once processing has finished. 57 /// phases or emitted once processing has finished.
58 /// 58 ///
59 /// Normally the primary input will automatically be forwarded unless the 59 /// Normally the primary input will automatically be forwarded unless the
60 /// transformer overwrites it by emitting an input with the same id. This 60 /// transformer overwrites it by emitting an input with the same id. This
61 /// allows the transformer to tell barback not to forward the primary input 61 /// allows the transformer to tell barback not to forward the primary input
62 /// even if it's not overwritten. 62 /// even if it's not overwritten.
63 void consumePrimary() => _aggregate.consumePrimary(primaryId); 63 void consumePrimary() => _aggregate.consumePrimary(primaryId);
64 } 64 }
OLDNEW
« no previous file with comments | « packages/barback/lib/src/transformer/barback_settings.dart ('k') | packages/barback/lib/src/transformer/transform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698