| Index: pkg/analyzer/lib/task/model.dart
|
| diff --git a/pkg/analyzer/lib/task/model.dart b/pkg/analyzer/lib/task/model.dart
|
| index 018b349cec3c6421e94454a5318b05247b31971e..9d949c308f836f0ec532fef3850f5e63d5bb39ff 100644
|
| --- a/pkg/analyzer/lib/task/model.dart
|
| +++ b/pkg/analyzer/lib/task/model.dart
|
| @@ -5,6 +5,7 @@
|
| library analyzer.task.model;
|
|
|
| import 'dart:collection';
|
| +import 'dart:developer';
|
|
|
| import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
|
| import 'package:analyzer/src/generated/error.dart' show AnalysisError;
|
| @@ -84,6 +85,12 @@ abstract class AnalysisTask {
|
| static final Map<Type, int> countMap = new HashMap<Type, int>();
|
|
|
| /**
|
| + * A table mapping the types of analysis tasks to user tags used to collect
|
| + * timing data for the Observatory.
|
| + */
|
| + static Map<Type, UserTag> tagMap = new HashMap<Type, UserTag>();
|
| +
|
| + /**
|
| * A table mapping the types of analysis tasks to stopwatches used to compute
|
| * how much time was spent executing each kind of task.
|
| */
|
| @@ -228,11 +235,15 @@ abstract class AnalysisTask {
|
| //
|
| int count = countMap[runtimeType];
|
| countMap[runtimeType] = count == null ? 1 : count + 1;
|
| +// UserTag tag = tagMap.putIfAbsent(
|
| +// runtimeType, () => new UserTag(runtimeType.toString()));
|
| Stopwatch stopwatch = stopwatchMap[runtimeType];
|
| if (stopwatch == null) {
|
| stopwatch = new Stopwatch();
|
| stopwatchMap[runtimeType] = stopwatch;
|
| }
|
| +// UserTag previousTag = tag.makeCurrent();
|
| +// try {
|
| stopwatch.start();
|
| //
|
| // Actually perform the task.
|
| @@ -245,6 +256,9 @@ abstract class AnalysisTask {
|
| } finally {
|
| stopwatch.stop();
|
| }
|
| +// } finally {
|
| +// previousTag.makeCurrent();
|
| +// }
|
| } on AnalysisException {
|
| rethrow;
|
| } catch (exception, stackTrace) {
|
| @@ -272,7 +286,7 @@ abstract class ListResultDescriptor<E> implements ResultDescriptor<List<E>> {
|
| E>;
|
|
|
| @override
|
| - ListTaskInput<E> of(AnalysisTarget target);
|
| + ListTaskInput<E> of(AnalysisTarget target, {bool flushOnAccess: false});
|
| }
|
|
|
| /**
|
| @@ -387,9 +401,10 @@ abstract class ResultDescriptor<V> {
|
|
|
| /**
|
| * Return a task input that can be used to compute this result for the given
|
| - * [target].
|
| + * [target]. If [flushOnAccess] is `true` then the value of this result that
|
| + * is associated with the [target] will be flushed when it is accessed.
|
| */
|
| - TaskInput<V> of(AnalysisTarget target);
|
| + TaskInput<V> of(AnalysisTarget target, {bool flushOnAccess: false});
|
| }
|
|
|
| /**
|
| @@ -530,6 +545,12 @@ abstract class TaskInputBuilder<V> {
|
| void set currentValue(Object value);
|
|
|
| /**
|
| + * Return `true` if the value accessed by this input builder should be flushed
|
| + * from the cache at the time it is retrieved.
|
| + */
|
| + bool get flushOnAccess;
|
| +
|
| + /**
|
| * Return the [value] that was computed by this builder.
|
| *
|
| * Throws a [StateError] if [moveNext] has not been invoked or if the last
|
|
|