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

Unified Diff: pkg/analyzer/lib/src/context/cache.dart

Issue 1218503003: Don't remove ResultData(s) for incrementally updated results. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Disable 'limitInvalidationInTaskModel' Created 5 years, 6 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 | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | pkg/analyzer/lib/src/context/context.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/context/cache.dart
diff --git a/pkg/analyzer/lib/src/context/cache.dart b/pkg/analyzer/lib/src/context/cache.dart
index 662e350532e63cc365deef3ba738922113b38fff..8a21142223521d50b917ee4e7fc051e36f61bccf 100644
--- a/pkg/analyzer/lib/src/context/cache.dart
+++ b/pkg/analyzer/lib/src/context/cache.dart
@@ -492,33 +492,41 @@ class CacheEntry {
* invalidation to other results that depend on it.
*/
void _invalidate(ResultDescriptor descriptor, Delta delta) {
- if (delta != null &&
- !delta.affects(_partition.context, target, descriptor)) {
-// print('not-invalidate $descriptor for $target');
- return;
+ DeltaResult deltaResult = null;
+ if (delta != null) {
+ deltaResult = delta.validate(_partition.context, target, descriptor);
+ if (deltaResult == DeltaResult.STOP) {
+// print('not-invalidate $descriptor for $target');
+ return;
+ }
}
// print('invalidate $descriptor for $target');
- ResultData thisData = _resultMap.remove(descriptor);
+ ResultData thisData;
+ if (deltaResult == null || deltaResult == DeltaResult.INVALIDATE) {
+ thisData = _resultMap.remove(descriptor);
+ }
+ if (deltaResult == DeltaResult.KEEP_CONTINUE) {
+ thisData = _resultMap[descriptor];
+ }
if (thisData == null) {
return;
}
// Stop depending on other results.
TargetedResult thisResult = new TargetedResult(target, descriptor);
- thisData.dependedOnResults.forEach((TargetedResult dependedOnResult) {
+ for (TargetedResult dependedOnResult in thisData.dependedOnResults) {
ResultData data = _partition._getDataFor(dependedOnResult, orNull: true);
if (data != null) {
data.dependentResults.remove(thisResult);
}
- });
+ }
// Invalidate results that depend on this result.
- Set<TargetedResult> dependentResults = thisData.dependentResults;
- thisData.dependentResults = new Set<TargetedResult>();
- dependentResults.forEach((TargetedResult dependentResult) {
+ List<TargetedResult> dependentResults = thisData.dependentResults.toList();
+ for (TargetedResult dependentResult in dependentResults) {
CacheEntry entry = _partition.get(dependentResult.target);
if (entry != null) {
entry._invalidate(dependentResult.result, delta);
}
- });
+ }
// If empty, remove the entry altogether.
if (_resultMap.isEmpty) {
_partition._targetMap.remove(target);
@@ -976,13 +984,18 @@ class Delta {
* Check whether this delta affects the result described by the given
* [descriptor] and [target].
*/
- bool affects(InternalAnalysisContext context, AnalysisTarget target,
+ DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target,
ResultDescriptor descriptor) {
- return true;
+ return DeltaResult.INVALIDATE;
}
}
/**
+ * The possible results of validating analysis results againt a [Delta].
+ */
+enum DeltaResult { INVALIDATE, KEEP_CONTINUE, STOP }
+
+/**
* [InvalidatedResult] describes an invalidated result.
*/
class InvalidatedResult {
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | pkg/analyzer/lib/src/context/context.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698