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

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

Issue 1400473008: Roll Observatory packages and add a roll script (Closed) Base URL: git@github.com:dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years, 2 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 | « packages/analyzer/lib/src/task/dart_work_manager.dart ('k') | packages/analyzer/lib/src/task/general.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/lib/src/task/driver.dart
diff --git a/analyzer/lib/src/task/driver.dart b/packages/analyzer/lib/src/task/driver.dart
similarity index 92%
rename from analyzer/lib/src/task/driver.dart
rename to packages/analyzer/lib/src/task/driver.dart
index ff5767db903edd1f5eabbf0ca856578b1fcb41a4..3231454d46fd79688b02692f2a3d02666af9ba35 100644
--- a/analyzer/lib/src/task/driver.dart
+++ b/packages/analyzer/lib/src/task/driver.dart
@@ -9,7 +9,7 @@ import 'dart:collection';
import 'package:analyzer/src/context/cache.dart';
import 'package:analyzer/src/generated/engine.dart'
- hide AnalysisTask, AnalysisContextImpl;
+ hide AnalysisTask, AnalysisContextImpl, WorkManager;
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/resolver.dart';
import 'package:analyzer/src/generated/utilities_general.dart';
@@ -44,7 +44,8 @@ class AnalysisDriver {
/**
* The map of [ComputedResult] controllers.
*/
- final Map<ResultDescriptor, StreamController<ComputedResult>> resultComputedControllers =
+ final Map<ResultDescriptor,
+ StreamController<ComputedResult>> resultComputedControllers =
<ResultDescriptor, StreamController<ComputedResult>>{};
/**
@@ -101,7 +102,12 @@ class AnalysisDriver {
WorkOrder workOrder = createWorkOrderForResult(target, result);
if (workOrder != null) {
while (workOrder.moveNext()) {
+// AnalysisTask previousTask = task;
+// String message = workOrder.current.toString();
task = performWorkItem(workOrder.current);
+// if (task == null) {
+// throw new AnalysisException(message, previousTask.caughtException);
+// }
}
}
return task;
@@ -197,8 +203,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 +484,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 +574,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);
@@ -658,6 +667,9 @@ class WorkItem {
}
} else {
builder.currentValue = inputEntry.getValue(inputResult);
+ if (builder.flushOnAccess) {
+ inputEntry.setState(inputResult, CacheState.FLUSHED);
+ }
}
if (!builder.moveNext()) {
inputs = builder.inputValue;
@@ -672,42 +684,6 @@ class WorkItem {
}
/**
- * [AnalysisDriver] uses [WorkManager]s to select results to compute.
- *
- * They know specific of the targets and results they care about,
- * so they can request analysis results in optimal order.
- */
-abstract class WorkManager {
- /**
- * Notifies the managers that the given set of priority [targets] was set.
- */
- void applyPriorityTargets(List<AnalysisTarget> targets);
-
- /**
- * Return the next [TargetedResult] that this work manager wants to be
- * computed, or `null` if this manager doesn't need any new results.
- */
- TargetedResult getNextResult();
-
- /**
- * Return the priority if the next work order this work manager want to be
- * computed. The [AnalysisDriver] will perform the work order with
- * the highest priority.
- *
- * Even if the returned value is [WorkOrderPriority.NONE], it still does not
- * guarantee that [getNextResult] will return not `null`.
- */
- WorkOrderPriority getNextResultPriority();
-
- /**
- * Notifies the manager that the given [outputs] were produced for
- * the given [target].
- */
- void resultsComputed(
- AnalysisTarget target, Map<ResultDescriptor, dynamic> outputs);
-}
-
-/**
* A description of the work to be done to compute a desired analysis result.
* The class implements a lazy depth-first traversal of the work item's input.
*/
@@ -774,31 +750,6 @@ class WorkOrder implements Iterator<WorkItem> {
}
/**
- * The priorities of work orders returned by [WorkManager]s.
- */
-enum WorkOrderPriority {
- /**
- * Responding to an user's action.
- */
- INTERACTIVE,
-
- /**
- * Computing information for priority sources.
- */
- PRIORITY,
-
- /**
- * A work should be done, but without any special urgency.
- */
- NORMAL,
-
- /**
- * Nothing to do.
- */
- NONE
-}
-
-/**
* Specilaization of [CycleAwareDependencyWalker] for use by [WorkOrder].
*/
class _WorkOrderDependencyWalker extends CycleAwareDependencyWalker<WorkItem> {
« no previous file with comments | « packages/analyzer/lib/src/task/dart_work_manager.dart ('k') | packages/analyzer/lib/src/task/general.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698