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

Side by Side Diff: sdk/lib/_internal/pub/asset/dart/serialize/transformer.dart

Issue 223553008: Only pass an AssetId to isPrimary and declareOutputs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fixes 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) 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 pub.asset.serialize.transformer; 5 library pub.asset.serialize.transformer;
6 6
7 import 'dart:isolate'; 7 import 'dart:isolate';
8 8
9 import 'package:barback/barback.dart'; 9 import 'package:barback/barback.dart';
10 // TODO(nweiz): don't import from "src" once issue 14966 is fixed. 10 // TODO(nweiz): don't import from "src" once issue 14966 is fixed.
11 import 'package:barback/src/internal_asset.dart'; 11 import 'package:barback/src/internal_asset.dart';
12 12
13 import '../serialize.dart'; 13 import '../serialize.dart';
14 import 'transform.dart'; 14 import 'transform.dart';
15 15
16 /// Converts [transformer] into a serializable map. 16 /// Converts [transformer] into a serializable map.
17 Map serializeTransformer(Transformer transformer) { 17 Map serializeTransformer(Transformer transformer) {
18 var port = new ReceivePort(); 18 var port = new ReceivePort();
19 port.listen((wrappedMessage) { 19 port.listen((wrappedMessage) {
20 respond(wrappedMessage, (message) { 20 respond(wrappedMessage, (message) {
21 if (message['type'] == 'isPrimary') { 21 if (message['type'] == 'isPrimary') {
22 return transformer.isPrimary(deserializeAsset(message['asset'])); 22 return transformer.isPrimary(deserializeId(message['id']));
23 } else { 23 } else {
24 assert(message['type'] == 'apply'); 24 assert(message['type'] == 'apply');
25 25
26 // Make sure we return null so that if the transformer's [apply] returns 26 // Make sure we return null so that if the transformer's [apply] returns
27 // a non-serializable value it doesn't cause problems. 27 // a non-serializable value it doesn't cause problems.
28 return transformer.apply( 28 return transformer.apply(
29 new ForeignTransform(message['transform'])).then((_) => null); 29 new ForeignTransform(message['transform'])).then((_) => null);
30 } 30 }
31 }); 31 });
32 }); 32 });
(...skipping 18 matching lines...) Expand all
51 51
52 /// Converts [transformerOrGroup] into a serializable map. 52 /// Converts [transformerOrGroup] into a serializable map.
53 Map serializeTransformerOrGroup(transformerOrGroup) { 53 Map serializeTransformerOrGroup(transformerOrGroup) {
54 if (transformerOrGroup is Transformer) { 54 if (transformerOrGroup is Transformer) {
55 return serializeTransformer(transformerOrGroup); 55 return serializeTransformer(transformerOrGroup);
56 } else { 56 } else {
57 assert(transformerOrGroup is TransformerGroup); 57 assert(transformerOrGroup is TransformerGroup);
58 return serializeTransformerGroup(transformerOrGroup); 58 return serializeTransformerGroup(transformerOrGroup);
59 } 59 }
60 } 60 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698