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

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

Issue 1339603004: Tweak for incremental result updates. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/test/src/context/cache_test.dart » ('j') | no next file with comments »
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 4e6607b5628fbea9fa3925f7c0627165a6df5ed8..01ae4ea85bf5ab9bcf220494b364339ab7e38d20 100644
--- a/pkg/analyzer/lib/src/context/cache.dart
+++ b/pkg/analyzer/lib/src/context/cache.dart
@@ -490,9 +490,9 @@ class CacheEntry {
*/
void setValueIncremental(ResultDescriptor descriptor, dynamic value) {
ResultData data = getResultData(descriptor);
- List<TargetedResult> dependedOn = data.dependedOnResults;
- _invalidate(descriptor, null);
- setValue(descriptor, value, dependedOn);
+ _invalidateDependentResults(data, null);
+ data.state = CacheState.VALID;
+ data.value = value;
}
@override
@@ -540,13 +540,7 @@ class CacheEntry {
}
}
// Invalidate results that depend on this result.
- 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);
- }
- }
+ _invalidateDependentResults(thisData, delta);
// If empty, remove the entry altogether.
if (_resultMap.isEmpty) {
_partition._targetMap.remove(target);
@@ -568,6 +562,19 @@ class CacheEntry {
}
/**
+ * Invalidate results that depend on [thisData].
+ */
+ void _invalidateDependentResults(ResultData thisData, Delta delta) {
+ 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);
+ }
+ }
+ }
+
+ /**
* Set the [dependedOn] on which this result depends.
*/
void _setDependedOnResults(ResultData thisData, TargetedResult thisResult,
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/cache_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698