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

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

Issue 22265002: Support cross-package transforms in barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove a duplicated test. Created 7 years, 4 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
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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 120
121 // Don't allow partial results from a failed transform. 121 // Don't allow partial results from a failed transform.
122 newOutputs.clear(); 122 newOutputs.clear();
123 }).then((_) { 123 }).then((_) {
124 if (_isDirty) return []; 124 if (_isDirty) return [];
125 125
126 return _adjustOutputs(newOutputs); 126 return _adjustOutputs(newOutputs);
127 }); 127 });
128 } 128 }
129 129
130 /// Gets the asset for an input [id].
131 ///
132 /// If an input with that ID cannot be found, throws an
133 /// [AssetNotFoundException].
130 Future<Asset> getInput(AssetId id) { 134 Future<Asset> getInput(AssetId id) {
131 return newFuture(() { 135 return phase.getInput(id).then((node) {
132 var node = phase.inputs[id];
133 // TODO(rnystrom): Need to handle passthrough where an asset from a
134 // previous phase can be found.
135
136 // Throw if the input isn't found. This ensures the transformer's apply 136 // Throw if the input isn't found. This ensures the transformer's apply
137 // is exited. We'll then catch this and report it through the proper 137 // is exited. We'll then catch this and report it through the proper
138 // results stream. 138 // results stream.
139 if (node == null) throw new MissingInputException(id); 139 if (node == null) throw new MissingInputException(id);
140 140
141 // If the asset node is found, wait until its contents are actually 141 // If the asset node is found, wait until its contents are actually
142 // available before we return them. 142 // available before we return them.
143 return node.whenAvailable.then((asset) { 143 return node.whenAvailable.then((asset) {
144 _inputSubscriptions.putIfAbsent(node.id, 144 _inputSubscriptions.putIfAbsent(node.id,
145 () => node.onStateChange.listen((_) => _dirty())); 145 () => node.onStateChange.listen((_) => _dirty()));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 } else { 184 } else {
185 var controller = new AssetNodeController.available(asset); 185 var controller = new AssetNodeController.available(asset);
186 _outputControllers[asset.id] = controller; 186 _outputControllers[asset.id] = controller;
187 brandNewOutputs.add(controller.node); 187 brandNewOutputs.add(controller.node);
188 } 188 }
189 } 189 }
190 190
191 return brandNewOutputs; 191 return brandNewOutputs;
192 } 192 }
193 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698