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

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

Issue 19841002: Remove calls to [new Future] work around issue 11911. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review change. Created 7 years, 5 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/asset_cascade.dart ('k') | pkg/barback/lib/src/utils.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; 5 library barback.transform;
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';
11 import 'asset_node.dart'; 11 import 'asset_node.dart';
12 import 'asset_set.dart'; 12 import 'asset_set.dart';
13 import 'errors.dart'; 13 import 'errors.dart';
14 import 'transform_node.dart'; 14 import 'transform_node.dart';
15 import 'utils.dart';
15 16
16 /// Creates a [Transform] by forwarding to the private constructor. 17 /// Creates a [Transform] by forwarding to the private constructor.
17 /// 18 ///
18 /// Lets [TransformNode] create [Transforms] without giving a [Transform] 19 /// Lets [TransformNode] create [Transforms] without giving a [Transform]
19 /// itself a public constructor, which would be visible to external users. 20 /// itself a public constructor, which would be visible to external users.
20 /// Unlike the [Transform] class, this function is not exported by barback.dart. 21 /// Unlike the [Transform] class, this function is not exported by barback.dart.
21 Transform createTransform(TransformNode node, Set<AssetNode> inputs, 22 Transform createTransform(TransformNode node, Set<AssetNode> inputs,
22 AssetSet outputs) => 23 AssetSet outputs) =>
23 new Transform._(node, inputs, outputs); 24 new Transform._(node, inputs, outputs);
24 25
(...skipping 24 matching lines...) Expand all
49 /// Gets the asset for the primary input. 50 /// Gets the asset for the primary input.
50 Future<Asset> get primaryInput => getInput(primaryId); 51 Future<Asset> get primaryInput => getInput(primaryId);
51 52
52 Transform._(this._node, this._inputs, this._outputs); 53 Transform._(this._node, this._inputs, this._outputs);
53 54
54 /// Gets the asset for for an input [id]. 55 /// Gets the asset for for an input [id].
55 /// 56 ///
56 /// If an input with that ID cannot be found, throws an 57 /// If an input with that ID cannot be found, throws an
57 /// [AssetNotFoundException]. 58 /// [AssetNotFoundException].
58 Future<Asset> getInput(AssetId id) { 59 Future<Asset> getInput(AssetId id) {
59 return new Future(() { 60 return newFuture(() {
60 var node = _node.phase.inputs[id]; 61 var node = _node.phase.inputs[id];
61 // TODO(rnystrom): Need to handle passthrough where an asset from a 62 // TODO(rnystrom): Need to handle passthrough where an asset from a
62 // previous phase can be found. 63 // previous phase can be found.
63 64
64 // Throw if the input isn't found. This ensures the transformer's apply 65 // Throw if the input isn't found. This ensures the transformer's apply
65 // is exited. We'll then catch this and report it through the proper 66 // is exited. We'll then catch this and report it through the proper
66 // results stream. 67 // results stream.
67 if (node == null) throw new MissingInputException(id); 68 if (node == null) throw new MissingInputException(id);
68 69
69 // Keep track of which assets this transform depends on. 70 // Keep track of which assets this transform depends on.
70 _inputs.add(node); 71 _inputs.add(node);
71 return node.asset; 72 return node.asset;
72 }); 73 });
73 } 74 }
74 75
75 /// Stores [output] as the output created by this transformation. 76 /// Stores [output] as the output created by this transformation.
76 /// 77 ///
77 /// A transformation can output as many assets as it wants. 78 /// A transformation can output as many assets as it wants.
78 void addOutput(Asset output) { 79 void addOutput(Asset output) {
79 // TODO(rnystrom): This should immediately throw if an output with that ID 80 // TODO(rnystrom): This should immediately throw if an output with that ID
80 // has already been created by this transformer. 81 // has already been created by this transformer.
81 _outputs.add(output); 82 _outputs.add(output);
82 } 83 }
83 } 84 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/asset_cascade.dart ('k') | pkg/barback/lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698