| 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 '../common/resolution.dart' show | 7 import '../common/resolution.dart' show |
| 8 ResolutionWorkItem; | 8 ResolutionWorkItem; |
| 9 import '../common/tasks.dart' show | 9 import '../common/tasks.dart' show |
| 10 CompilerTask; | 10 CompilerTask; |
| 11 import '../common/work.dart' show | 11 import '../common/work.dart' show |
| 12 ItemCompilationContext; | 12 ItemCompilationContext; |
| 13 import '../compiler.dart' show | 13 import '../compiler.dart' show |
| 14 Compiler; | 14 Compiler; |
| 15 import '../elements/elements.dart'; | 15 import '../elements/elements.dart'; |
| 16 import '../enqueue.dart' show | 16 import '../enqueue.dart' show |
| 17 ResolutionEnqueuer; | 17 ResolutionEnqueuer; |
| 18 import '../universe/world_impact.dart' show | 18 import '../universe/world_impact.dart' show |
| 19 WorldImpact; | 19 WorldImpact; |
| 20 | 20 |
| 21 /// Task that supports deserialization of elements. | 21 /// Task that supports deserialization of elements. |
| 22 class SerializationTask extends CompilerTask { | 22 class SerializationTask extends CompilerTask { |
| 23 SerializationTask(Compiler compiler) : super(compiler); | 23 SerializationTask(Compiler compiler) : super(compiler); |
| 24 | 24 |
| 25 DeserializerSystem deserializer; | 25 DeserializerSystem deserializer; |
| 26 | 26 |
| 27 String get name => 'Serialization'; | 27 String get name => 'Serialization'; |
| 28 | 28 |
| 29 /// If `true`, data must be retained to support serialization. |
| 30 // TODO(johnniwinther): Make this more precise in terms of what needs to be |
| 31 // retained, for instance impacts, resolution data etc. |
| 32 bool supportSerialization = false; |
| 33 |
| 29 /// Returns the [LibraryElement] for [resolvedUri] if available from | 34 /// Returns the [LibraryElement] for [resolvedUri] if available from |
| 30 /// serialization. | 35 /// serialization. |
| 31 LibraryElement readLibrary(Uri resolvedUri) { | 36 LibraryElement readLibrary(Uri resolvedUri) { |
| 32 if (deserializer == null) return null; | 37 if (deserializer == null) return null; |
| 33 return deserializer.readLibrary(resolvedUri); | 38 return deserializer.readLibrary(resolvedUri); |
| 34 } | 39 } |
| 35 | 40 |
| 36 /// Returns `true` if [element] has been deserialized. | 41 /// Returns `true` if [element] has been deserialized. |
| 37 bool isDeserialized(Element element) { | 42 bool isDeserialized(Element element) { |
| 38 return deserializer != null && deserializer.isDeserialized(element); | 43 return deserializer != null && deserializer.isDeserialized(element); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 76 } |
| 72 } | 77 } |
| 73 | 78 |
| 74 /// The interface for a system that supports deserialization of libraries and | 79 /// The interface for a system that supports deserialization of libraries and |
| 75 /// elements. | 80 /// elements. |
| 76 abstract class DeserializerSystem { | 81 abstract class DeserializerSystem { |
| 77 LibraryElement readLibrary(Uri resolvedUri); | 82 LibraryElement readLibrary(Uri resolvedUri); |
| 78 bool isDeserialized(Element element); | 83 bool isDeserialized(Element element); |
| 79 WorldImpact computeWorldImpact(Element element); | 84 WorldImpact computeWorldImpact(Element element); |
| 80 } | 85 } |
| OLD | NEW |