| 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 EventSink, Future; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem; | 9 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem; |
| 10 import '../common/tasks.dart' show CompilerTask; | 10 import '../common/tasks.dart' show CompilerTask; |
| 11 import '../common/work.dart' show ItemCompilationContext; | 11 import '../common/work.dart' show ItemCompilationContext; |
| 12 import '../compiler.dart' show Compiler; | 12 import '../compiler.dart' show Compiler; |
| 13 import '../elements/elements.dart'; | 13 import '../elements/elements.dart'; |
| 14 import '../enqueue.dart' show ResolutionEnqueuer; | 14 import '../enqueue.dart' show ResolutionEnqueuer; |
| 15 import '../universe/world_impact.dart' show WorldImpact; | 15 import '../universe/world_impact.dart' show WorldImpact; |
| 16 import 'json_serializer.dart'; | 16 import 'json_serializer.dart'; |
| 17 import 'serialization.dart'; | 17 import 'serialization.dart'; |
| 18 import 'system.dart'; | 18 import 'system.dart'; |
| 19 | 19 |
| 20 /// A deserializer that can load a library element by reading it's information | 20 /// A deserializer that can load a library element by reading it's information |
| 21 /// from a serialized form. | 21 /// from a serialized form. |
| 22 abstract class LibraryDeserializer { | 22 abstract class LibraryDeserializer { |
| 23 /// Loads the [LibraryElement] associated with a library under [uri], or null | 23 /// Loads the [LibraryElement] associated with a library under [uri], or null |
| 24 /// if no serialized information is available for the given library. | 24 /// if no serialized information is available for the given library. |
| 25 Future<LibraryElement> readLibrary(Uri uri); | 25 Future<LibraryElement> readLibrary(Uri uri); |
| 26 } | 26 } |
| 27 | 27 |
| 28 /// Task that supports deserialization of elements. | 28 /// Task that supports deserialization of elements. |
| 29 class SerializationTask extends CompilerTask implements LibraryDeserializer { | 29 class SerializationTask extends CompilerTask implements LibraryDeserializer { |
| 30 SerializationTask(Compiler compiler) : super(compiler); | 30 final Compiler compiler; |
| 31 SerializationTask(Compiler compiler) |
| 32 : compiler = compiler, |
| 33 super(compiler.measurer); |
| 31 | 34 |
| 32 DeserializerSystem deserializer; | 35 DeserializerSystem deserializer; |
| 33 | 36 |
| 34 String get name => 'Serialization'; | 37 String get name => 'Serialization'; |
| 35 | 38 |
| 36 /// If `true`, data must be retained to support serialization. | 39 /// If `true`, data must be retained to support serialization. |
| 37 // TODO(johnniwinther): Make this more precise in terms of what needs to be | 40 // TODO(johnniwinther): Make this more precise in terms of what needs to be |
| 38 // retained, for instance impacts, resolution data etc. | 41 // retained, for instance impacts, resolution data etc. |
| 39 bool supportSerialization = false; | 42 bool supportSerialization = false; |
| 40 | 43 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 /// elements. | 155 /// elements. |
| 153 abstract class DeserializerSystem { | 156 abstract class DeserializerSystem { |
| 154 Future<LibraryElement> readLibrary(Uri resolvedUri); | 157 Future<LibraryElement> readLibrary(Uri resolvedUri); |
| 155 bool isDeserialized(Element element); | 158 bool isDeserialized(Element element); |
| 156 bool hasResolvedAst(ExecutableElement element); | 159 bool hasResolvedAst(ExecutableElement element); |
| 157 ResolvedAst getResolvedAst(ExecutableElement element); | 160 ResolvedAst getResolvedAst(ExecutableElement element); |
| 158 bool hasResolutionImpact(Element element); | 161 bool hasResolutionImpact(Element element); |
| 159 ResolutionImpact getResolutionImpact(Element element); | 162 ResolutionImpact getResolutionImpact(Element element); |
| 160 WorldImpact computeWorldImpact(Element element); | 163 WorldImpact computeWorldImpact(Element element); |
| 161 } | 164 } |
| OLD | NEW |