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

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

Issue 2531303002: Decouple WorkItem from Compiler (Closed)
Patch Set: Updated cf. comments. Created 4 years 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 EventSink, Future; 7 import 'dart:async' show EventSink, Future;
8 8
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;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 }); 131 });
132 } 132 }
133 } 133 }
134 134
135 /// A [ResolutionWorkItem] for a deserialized element. 135 /// A [ResolutionWorkItem] for a deserialized element.
136 /// 136 ///
137 /// This will not resolve the element but only compute the [WorldImpact]. 137 /// This will not resolve the element but only compute the [WorldImpact].
138 class DeserializedResolutionWorkItem implements ResolutionWorkItem { 138 class DeserializedResolutionWorkItem implements ResolutionWorkItem {
139 final Element element; 139 final Element element;
140 final WorldImpact worldImpact; 140 final WorldImpact worldImpact;
141 bool _isAnalyzed = false;
142 141
143 DeserializedResolutionWorkItem(this.element, this.worldImpact); 142 DeserializedResolutionWorkItem(this.element, this.worldImpact);
144 143
145 @override 144 @override
146 bool get isAnalyzed => _isAnalyzed; 145 WorldImpact run() {
147
148 @override
149 WorldImpact run(Compiler compiler, ResolutionEnqueuer world) {
150 _isAnalyzed = true;
151 world.registerProcessedElement(element);
152 return worldImpact; 146 return worldImpact;
153 } 147 }
154 } 148 }
155 149
156 /// The interface for a system that supports deserialization of libraries and 150 /// The interface for a system that supports deserialization of libraries and
157 /// elements. 151 /// elements.
158 abstract class DeserializerSystem { 152 abstract class DeserializerSystem {
159 Future<LibraryElement> readLibrary(Uri resolvedUri); 153 Future<LibraryElement> readLibrary(Uri resolvedUri);
160 bool isDeserialized(Element element); 154 bool isDeserialized(Element element);
161 bool hasResolvedAst(ExecutableElement element); 155 bool hasResolvedAst(ExecutableElement element);
162 ResolvedAst getResolvedAst(ExecutableElement element); 156 ResolvedAst getResolvedAst(ExecutableElement element);
163 bool hasResolutionImpact(Element element); 157 bool hasResolutionImpact(Element element);
164 ResolutionImpact getResolutionImpact(Element element); 158 ResolutionImpact getResolutionImpact(Element element);
165 WorldImpact computeWorldImpact(Element element); 159 WorldImpact computeWorldImpact(Element element);
166 } 160 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/impact_serialization.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698