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

Side by Side Diff: pkg/compiler/lib/src/serialization/task.dart

Issue 2760923004: Eliminate multi-callback structure for LibraryLoader. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
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 Future; 7 import 'dart:async' show Future;
8 8
9 import '../../compiler_new.dart'; 9 import '../../compiler_new.dart';
10 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem; 10 import '../common/resolution.dart' show ResolutionImpact, ResolutionWorkItem;
11 import '../common/tasks.dart' show CompilerTask; 11 import '../common/tasks.dart' show CompilerTask;
12 import '../compiler.dart' show Compiler; 12 import '../compiler.dart' show Compiler;
13 import '../elements/elements.dart'; 13 import '../elements/elements.dart';
14 import '../universe/world_impact.dart' show WorldImpact; 14 import '../universe/world_impact.dart' show WorldImpact;
15 import 'json_serializer.dart'; 15 import 'json_serializer.dart';
16 import 'serialization.dart'; 16 import 'serialization.dart';
17 import 'system.dart'; 17 import 'system.dart';
18 18
19 /// 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
20 /// from a serialized form. 20 /// from a serialized form.
21 abstract class LibraryDeserializer { 21 abstract class LibraryDeserializer {
22 /// Loads the [LibraryElement] associated with a library under [uri], or null 22 /// Loads the [LibraryElement] associated with a library under [uri], or null
23 /// if no serialized information is available for the given library. 23 /// if no serialized information is available for the given library.
24 Future<LibraryElement> readLibrary(Uri uri); 24 Future<LibraryElement> readLibrary(Uri uri);
25
26 /// Returns `true` if [element] has been deserialized.
27 bool isDeserialized(Element element);
25 } 28 }
26 29
27 /// Task that supports deserialization of elements. 30 /// Task that supports deserialization of elements.
28 class SerializationTask extends CompilerTask implements LibraryDeserializer { 31 class SerializationTask extends CompilerTask implements LibraryDeserializer {
29 final Compiler compiler; 32 final Compiler compiler;
30 SerializationTask(Compiler compiler) 33 SerializationTask(Compiler compiler)
31 : compiler = compiler, 34 : compiler = compiler,
32 super(compiler.measurer); 35 super(compiler.measurer);
33 36
34 DeserializerSystem deserializer; 37 DeserializerSystem deserializer;
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 /// elements. 153 /// elements.
151 abstract class DeserializerSystem { 154 abstract class DeserializerSystem {
152 Future<LibraryElement> readLibrary(Uri resolvedUri); 155 Future<LibraryElement> readLibrary(Uri resolvedUri);
153 bool isDeserialized(Element element); 156 bool isDeserialized(Element element);
154 bool hasResolvedAst(ExecutableElement element); 157 bool hasResolvedAst(ExecutableElement element);
155 ResolvedAst getResolvedAst(ExecutableElement element); 158 ResolvedAst getResolvedAst(ExecutableElement element);
156 bool hasResolutionImpact(Element element); 159 bool hasResolutionImpact(Element element);
157 ResolutionImpact getResolutionImpact(Element element); 160 ResolutionImpact getResolutionImpact(Element element);
158 WorldImpact computeWorldImpact(Element element); 161 WorldImpact computeWorldImpact(Element element);
159 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698