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

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

Issue 1120313004: Get memento objects from tasks, remember in cache and pass back to tasks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 ab5887234a8d0f46e776df4cfa8db22c5afe893c..924e8ff2a9d80738c1adfde75ba5cdacba7dfe85 100644
--- a/pkg/analyzer/lib/src/task/driver.dart
+++ b/pkg/analyzer/lib/src/task/driver.dart
@@ -124,8 +124,10 @@ class AnalysisDriver {
return null;
}
try {
- return new WorkOrder(taskManager,
- new WorkItem(context, target, taskManager.findTask(target, result)));
+ TaskDescriptor taskDescriptor = taskManager.findTask(target, result);
+ var memento = entry.getMemento(result);
+ var workItem = new WorkItem(context, target, taskDescriptor, memento);
+ return new WorkOrder(taskManager, workItem);
} catch (exception, stackTrace) {
throw new AnalysisException(
'Could not create work order (target = $target; result = $result)',
@@ -215,7 +217,7 @@ class AnalysisDriver {
for (ResultDescriptor result in task.descriptor.results) {
// TODO(brianwilkerson) We could check here that a value was produced
// and throw an exception if not (unless we want to allow null values).
- entry.setValue(result, outputs[result], dependedOn);
+ entry.setValue(result, outputs[result], dependedOn, task.outputMemento);
}
} else {
entry.setErrorState(task.caughtException, item.descriptor.results);
@@ -280,6 +282,12 @@ class WorkItem {
final TaskDescriptor descriptor;
/**
+ * The optional data that the task associated with [target] last time.
+ * This data may help to compute outputs more efficiently.
+ */
+ final memento;
Brian Wilkerson 2015/05/04 16:22:09 Should this be "inputMemento"?
+
+ /**
* An iterator used to iterate over the descriptors of the inputs to the task,
* or `null` if all of the inputs have been collected and the task can be
* created.
@@ -309,7 +317,7 @@ class WorkItem {
* Initialize a newly created work item to compute the inputs for the task
* described by the given descriptor.
*/
- WorkItem(this.context, this.target, this.descriptor) {
+ WorkItem(this.context, this.target, this.descriptor, this.memento) {
AnalysisTarget actualTarget = identical(
target, AnalysisContextTarget.request)
? new AnalysisContextTarget(context)
@@ -330,7 +338,7 @@ class WorkItem {
if (builder != null) {
throw new StateError("some inputs have not been computed");
}
- return descriptor.createTask(context, target, inputs);
+ return descriptor.createTask(context, target, inputs, memento);
}
/**
@@ -375,7 +383,8 @@ class WorkItem {
try {
TaskDescriptor descriptor =
taskManager.findTask(inputTarget, inputResult);
- return new WorkItem(context, inputTarget, descriptor);
+ dynamic memento = inputEntry.getMemento(inputResult);
+ return new WorkItem(context, inputTarget, descriptor, memento);
} on AnalysisException catch (exception, stackTrace) {
this.exception = new CaughtException(exception, stackTrace);
return null;

Powered by Google App Engine
This is Rietveld 408576698