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

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

Issue 1311773005: Extension point for WorkManagerFactory(s). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
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 ff5767db903edd1f5eabbf0ca856578b1fcb41a4..fd620a22b796e18cf6259faa9194e6b46a3071b3 100644
--- a/pkg/analyzer/lib/src/task/driver.dart
+++ b/pkg/analyzer/lib/src/task/driver.dart
@@ -12,10 +12,12 @@ import 'package:analyzer/src/generated/engine.dart'
hide AnalysisTask, AnalysisContextImpl;
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/task/inputs.dart';
import 'package:analyzer/src/task/manager.dart';
import 'package:analyzer/task/model.dart';
+import 'package:analyzer/src/generated/error.dart';
final PerformanceTag workOrderMoveNextPerfTag =
new PerformanceTag('WorkOrder.moveNext');
@@ -44,7 +46,8 @@ class AnalysisDriver {
/**
* The map of [ComputedResult] controllers.
*/
- final Map<ResultDescriptor, StreamController<ComputedResult>> resultComputedControllers =
+ final Map<ResultDescriptor,
+ StreamController<ComputedResult>> resultComputedControllers =
<ResultDescriptor, StreamController<ComputedResult>>{};
/**
@@ -197,8 +200,10 @@ class AnalysisDriver {
* [descriptor] is computed.
*/
Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor) {
- return resultComputedControllers.putIfAbsent(descriptor, () =>
- new StreamController<ComputedResult>.broadcast(sync: true)).stream;
+ return resultComputedControllers
+ .putIfAbsent(descriptor,
+ () => new StreamController<ComputedResult>.broadcast(sync: true))
+ .stream;
}
/**
@@ -476,8 +481,9 @@ class InfiniteTaskLoopException extends AnalysisException {
* Initialize a newly created exception to represent a failed attempt to
* perform the given [task] due to the given [dependencyCycle].
*/
- InfiniteTaskLoopException(AnalysisTask task, this.dependencyCycle) : super(
- 'Infinite loop while performing task ${task.descriptor.name} for ${task.target}');
+ InfiniteTaskLoopException(AnalysisTask task, this.dependencyCycle)
+ : super(
+ 'Infinite loop while performing task ${task.descriptor.name} for ${task.target}');
}
/**
@@ -565,10 +571,10 @@ class WorkItem {
* described by the given descriptor.
*/
WorkItem(this.context, this.target, this.descriptor, this.spawningResult) {
- AnalysisTarget actualTarget = identical(
- target, AnalysisContextTarget.request)
- ? new AnalysisContextTarget(context)
- : target;
+ AnalysisTarget actualTarget =
+ identical(target, AnalysisContextTarget.request)
+ ? new AnalysisContextTarget(context)
+ : target;
Map<String, TaskInput> inputDescriptors =
descriptor.createTaskInputs(actualTarget);
builder = new TopLevelTaskInputBuilder(inputDescriptors);
@@ -679,11 +685,25 @@ class WorkItem {
*/
abstract class WorkManager {
/**
+ * Notifies the manager about changes in the explicit source list.
+ */
+ void applyChange(List<Source> addedSources, List<Source> changedSources,
+ List<Source> removedSources);
+
+ /**
* Notifies the managers that the given set of priority [targets] was set.
*/
void applyPriorityTargets(List<AnalysisTarget> targets);
/**
+ * Return a list of all of the errors associated with the given [source].
+ * The list of errors will be empty if the source is not known to the context
+ * or if there are no errors in the source. The errors contained in the list
+ * can be incomplete.
+ */
+ List<AnalysisError> getErrors(Source source);
+
+ /**
* Return the next [TargetedResult] that this work manager wants to be
* computed, or `null` if this manager doesn't need any new results.
*/
@@ -700,6 +720,16 @@ abstract class WorkManager {
WorkOrderPriority getNextResultPriority();
/**
+ * Notifies the manager about analysis options changes.
+ */
+ void onAnalysisOptionsChanged();
+
+ /**
+ * Notifies the manager about [SourceFactory] changes.
+ */
+ void onSourceFactoryChanged();
+
+ /**
* Notifies the manager that the given [outputs] were produced for
* the given [target].
*/

Powered by Google App Engine
This is Rietveld 408576698