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

Unified Diff: pkg/analyzer/lib/src/task/driver.dart

Issue 1555073003: Replace ResultProvider with 'aboutToComputeResult'. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/driver.dart
diff --git a/pkg/analyzer/lib/src/task/driver.dart b/pkg/analyzer/lib/src/task/driver.dart
index 55cf6dafac0369e9ff07ceaf154ccf8c98ec58a5..db9cd1d46e1715fc4cb8a2711a36f45eda372f37 100644
--- a/pkg/analyzer/lib/src/task/driver.dart
+++ b/pkg/analyzer/lib/src/task/driver.dart
@@ -44,11 +44,6 @@ class AnalysisDriver {
final InternalAnalysisContext context;
/**
- * The alternative source of analysis results.
- */
- ResultProvider resultProvider;
-
- /**
* The map of [ComputedResult] controllers.
*/
final Map<ResultDescriptor, StreamController<ComputedResult>>
@@ -172,8 +167,8 @@ class AnalysisDriver {
}
TaskDescriptor taskDescriptor = taskManager.findTask(target, result);
try {
- WorkItem workItem = new WorkItem(
- context, resultProvider, target, taskDescriptor, result, 0, null);
+ WorkItem workItem =
+ new WorkItem(context, target, taskDescriptor, result, 0, null);
return new WorkOrder(taskManager, workItem);
} catch (exception, stackTrace) {
throw new AnalysisException(
@@ -509,24 +504,6 @@ class InfiniteTaskLoopException extends AnalysisException {
}
/**
- * The object used by [WorkItem] to get values without using tasks.
- */
-abstract class ResultProvider {
- /**
- * [WorkItem] calls this method when the [result] of the [entry] is
- * [CacheState.INVALID], so it is about to schedule its computation.
- *
- * If the provider knows how to provide the value, it sets the value into
- * the [entry] with all required dependencies, and returns `true`.
- *
- * Otherwise, it returns `false` to indicate that the [WorkItem] should
- * compute the value.
- */
- bool provideResult(InternalAnalysisContext context, CacheEntry entry,
- ResultDescriptor result);
-}
-
-/**
* Object used by [CycleAwareDependencyWalker] to report a single strongly
* connected component of nodes.
*/
@@ -558,11 +535,6 @@ class WorkItem {
final InternalAnalysisContext context;
/**
- * The alternative source of analysis results.
- */
- final ResultProvider resultProvider;
-
- /**
* The target for which a task is to be performed.
*/
final AnalysisTarget target;
@@ -625,8 +597,8 @@ class WorkItem {
* Initialize a newly created work item to compute the inputs for the task
* described by the given descriptor.
*/
- WorkItem(this.context, this.resultProvider, this.target, this.descriptor,
- this.spawningResult, this.level, this.workOrder) {
+ WorkItem(this.context, this.target, this.descriptor, this.spawningResult,
+ this.level, this.workOrder) {
AnalysisTarget actualTarget =
identical(target, AnalysisContextTarget.request)
? new AnalysisContextTarget(context)
@@ -730,16 +702,15 @@ class WorkItem {
//
throw new UnimplementedError();
} else if (inputState != CacheState.VALID) {
- if (resultProvider != null &&
- resultProvider.provideResult(context, inputEntry, inputResult)) {
+ if (context.aboutToComputeResult(inputEntry, inputResult)) {
inputState = CacheState.VALID;
builder.currentValue = inputEntry.getValue(inputResult);
} else {
try {
TaskDescriptor descriptor =
taskManager.findTask(inputTarget, inputResult);
- return new WorkItem(context, resultProvider, inputTarget,
- descriptor, inputResult, level + 1, workOrder);
+ return new WorkItem(context, inputTarget, descriptor, inputResult,
+ level + 1, workOrder);
} on AnalysisException catch (exception, stackTrace) {
this.exception = new CaughtException(exception, stackTrace);
return null;
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/generated/engine_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698