OLD | NEW |
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 pub.load_transformers; | 5 library pub.load_transformers; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:convert'; | 8 import 'dart:convert'; |
9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
10 | 10 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 /// transformer. | 84 /// transformer. |
85 final SendPort _port; | 85 final SendPort _port; |
86 | 86 |
87 /// The result of calling [toString] on the transformer in the isolate. | 87 /// The result of calling [toString] on the transformer in the isolate. |
88 final String _toString; | 88 final String _toString; |
89 | 89 |
90 _ForeignTransformer(Map map) | 90 _ForeignTransformer(Map map) |
91 : _port = map['port'], | 91 : _port = map['port'], |
92 _toString = map['toString']; | 92 _toString = map['toString']; |
93 | 93 |
94 Future<bool> isPrimary(Asset asset) { | 94 Future<bool> isPrimary(AssetId id) { |
95 return call(_port, { | 95 return call(_port, { |
96 'type': 'isPrimary', | 96 'type': 'isPrimary', |
97 'asset': serializeAsset(asset) | 97 'id': serializeId(id) |
98 }); | 98 }); |
99 } | 99 } |
100 | 100 |
101 Future apply(Transform transform) { | 101 Future apply(Transform transform) { |
102 return call(_port, { | 102 return call(_port, { |
103 'type': 'apply', | 103 'type': 'apply', |
104 'transform': serializeTransform(transform) | 104 'transform': serializeTransform(transform) |
105 }); | 105 }); |
106 } | 106 } |
107 | 107 |
(...skipping 20 matching lines...) Expand all Loading... |
128 /// Converts a serializable map into a [Transformer] or a [TransformerGroup]. | 128 /// Converts a serializable map into a [Transformer] or a [TransformerGroup]. |
129 _deserializeTransformerOrGroup(Map map, TransformerId id) { | 129 _deserializeTransformerOrGroup(Map map, TransformerId id) { |
130 if (map['type'] == 'Transformer') { | 130 if (map['type'] == 'Transformer') { |
131 var transformer = new _ForeignTransformer(map); | 131 var transformer = new _ForeignTransformer(map); |
132 return ExcludingTransformer.wrap(transformer, id.includes, id.excludes); | 132 return ExcludingTransformer.wrap(transformer, id.includes, id.excludes); |
133 } | 133 } |
134 | 134 |
135 assert(map['type'] == 'TransformerGroup'); | 135 assert(map['type'] == 'TransformerGroup'); |
136 return new _ForeignGroup(id, map); | 136 return new _ForeignGroup(id, map); |
137 } | 137 } |
OLD | NEW |