| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dart2js.serialization.task; | 5 library dart2js.serialization.task; |
| 6 | 6 |
| 7 import 'dart:async' show EventSink, Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import '../../compiler_new.dart'; |
| 9 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem; | 10 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem; |
| 10 import '../common/tasks.dart' show CompilerTask; | 11 import '../common/tasks.dart' show CompilerTask; |
| 11 import '../compiler.dart' show Compiler; | 12 import '../compiler.dart' show Compiler; |
| 12 import '../elements/elements.dart'; | 13 import '../elements/elements.dart'; |
| 13 import '../universe/world_impact.dart' show WorldImpact; | 14 import '../universe/world_impact.dart' show WorldImpact; |
| 14 import 'json_serializer.dart'; | 15 import 'json_serializer.dart'; |
| 15 import 'serialization.dart'; | 16 import 'serialization.dart'; |
| 16 import 'system.dart'; | 17 import 'system.dart'; |
| 17 | 18 |
| 18 /// A deserializer that can load a library element by reading it's information | 19 /// A deserializer that can load a library element by reading it's information |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 serializer.plugins.add(new ResolvedAstSerializerPlugin( | 99 serializer.plugins.add(new ResolvedAstSerializerPlugin( |
| 99 compiler.resolution, backendSerializer)); | 100 compiler.resolution, backendSerializer)); |
| 100 | 101 |
| 101 for (LibraryElement library in libraries) { | 102 for (LibraryElement library in libraries) { |
| 102 serializer.serialize(library); | 103 serializer.serialize(library); |
| 103 } | 104 } |
| 104 return serializer; | 105 return serializer; |
| 105 }); | 106 }); |
| 106 } | 107 } |
| 107 | 108 |
| 108 void serializeToSink( | 109 void serializeToSink(OutputSink sink, Iterable<LibraryElement> libraries) { |
| 109 EventSink<String> sink, Iterable<LibraryElement> libraries) { | |
| 110 measure(() { | 110 measure(() { |
| 111 sink | 111 sink |
| 112 ..add(createSerializer(libraries) | 112 ..add(createSerializer(libraries) |
| 113 .toText(const JsonSerializationEncoder())) | 113 .toText(const JsonSerializationEncoder())) |
| 114 ..close(); | 114 ..close(); |
| 115 }); | 115 }); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void deserializeFromText(Uri sourceUri, String serializedData) { | 118 void deserializeFromText(Uri sourceUri, String serializedData) { |
| 119 measure(() { | 119 measure(() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 150 /// elements. | 150 /// elements. |
| 151 abstract class DeserializerSystem { | 151 abstract class DeserializerSystem { |
| 152 Future<LibraryElement> readLibrary(Uri resolvedUri); | 152 Future<LibraryElement> readLibrary(Uri resolvedUri); |
| 153 bool isDeserialized(Element element); | 153 bool isDeserialized(Element element); |
| 154 bool hasResolvedAst(ExecutableElement element); | 154 bool hasResolvedAst(ExecutableElement element); |
| 155 ResolvedAst getResolvedAst(ExecutableElement element); | 155 ResolvedAst getResolvedAst(ExecutableElement element); |
| 156 bool hasResolutionImpact(Element element); | 156 bool hasResolutionImpact(Element element); |
| 157 ResolutionImpact getResolutionImpact(Element element); | 157 ResolutionImpact getResolutionImpact(Element element); |
| 158 WorldImpact computeWorldImpact(Element element); | 158 WorldImpact computeWorldImpact(Element element); |
| 159 } | 159 } |
| OLD | NEW |