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

Side by Side Diff: pkg/barback/test/transformer/declare_assets.dart

Issue 241223005: Fix a deadlock bug with lazy transformer pipelining. (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
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.test.transformer.declare_asset; 5 library barback.test.transformer.declare_asset;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:barback/barback.dart'; 9 import 'package:barback/barback.dart';
10 import 'package:barback/src/utils.dart'; 10 import 'package:barback/src/utils.dart';
11 11
12 import 'mock.dart'; 12 import 'mock.dart';
13 13
14 /// A transformer that declares some outputs and emits others. 14 /// A transformer that declares some outputs and emits others.
15 class DeclareAssetsTransformer extends MockTransformer 15 class DeclareAssetsTransformer extends MockTransformer
16 implements DeclaringTransformer { 16 implements DeclaringTransformer {
17 /// The assets that the transformer declares that it will emit. 17 /// The assets that the transformer declares that it will emit.
18 final List<AssetId> declared; 18 final List<AssetId> declared;
19 19
20 /// The assets that the transformer actually emits. 20 /// The assets that the transformer actually emits.
21 /// 21 ///
22 /// These assets' contents will be identical to their ids. 22 /// These assets' contents will be identical to their ids.
23 final List<AssetId> emitted; 23 final List<AssetId> emitted;
24 24
25 DeclareAssetsTransformer(Iterable<String> declared, Iterable<String> emitted) 25 DeclareAssetsTransformer(Iterable<String> declared, [Iterable<String> emitted] )
26 : this.declared = declared.map((id) => new AssetId.parse(id)).toList(), 26 : this.declared = declared.map((id) => new AssetId.parse(id)).toList(),
27 this.emitted = emitted.map((id) => new AssetId.parse(id)).toList(); 27 this.emitted = (emitted == null ? declared : emitted)
28 .map((id) => new AssetId.parse(id)).toList();
28 29
29 Future<bool> doIsPrimary(AssetId id) => new Future.value(true); 30 Future<bool> doIsPrimary(AssetId id) => new Future.value(true);
30 31
31 Future doApply(Transform transform) { 32 Future doApply(Transform transform) {
32 return newFuture(() { 33 return newFuture(() {
33 for (var id in emitted) { 34 for (var id in emitted) {
34 transform.addOutput(new Asset.fromString(id, id.toString())); 35 transform.addOutput(new Asset.fromString(id, id.toString()));
35 } 36 }
36 }); 37 });
37 } 38 }
38 39
39 Future declareOutputs(DeclaringTransform transform) { 40 Future declareOutputs(DeclaringTransform transform) {
40 return newFuture(() { 41 return newFuture(() {
41 declared.forEach(transform.declareOutput); 42 declared.forEach(transform.declareOutput);
42 }); 43 });
43 } 44 }
44 } 45 }
OLDNEW
« no previous file with comments | « pkg/barback/test/package_graph/lazy_transformer_test.dart ('k') | pkg/barback/test/transformer/lazy_assets.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698