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

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

Issue 2134283002: When validating cache consistency, skip sources in content cache. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/context_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/context.dart
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index 46aeab901001b4954034d4ba5a1e8265b6fc4fc1..858fd0636a60235d799a0f331834c973c7a6e256 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -2058,13 +2058,7 @@ class CacheConsistencyValidatorImpl implements CacheConsistencyValidator {
@override
List<Source> getSourcesToComputeModificationTimes() {
- List<Source> sources = <Source>[];
- for (Source source in context._privatePartition.sources) {
- if (context._contentCache.getModificationStamp(source) == null) {
- sources.add(source);
- }
- }
- return sources;
+ return context._privatePartition.sources.toList();
}
@override
@@ -2074,22 +2068,31 @@ class CacheConsistencyValidatorImpl implements CacheConsistencyValidator {
HashSet<Source> missingSources = new HashSet<Source>();
for (int i = 0; i < sources.length; i++) {
Source source = sources[i];
+ // When a source is in the content cache,
+ // its modification time in the file system does not matter.
+ if (context._contentCache.getModificationStamp(source) != null) {
+ continue;
+ }
+ // When we were not able to compute the modification time in the
+ // file system, there is nothing to compare with, so skip the source.
int sourceTime = times[i];
- if (sourceTime != null) {
- CacheEntry entry = context._privatePartition.get(source);
- if (entry != null) {
- if (sourceTime != entry.modificationTime) {
- changedSources.add(source);
+ if (sourceTime == null) {
+ continue;
+ }
+ // Compare with the modification time in the cache entry.
+ CacheEntry entry = context._privatePartition.get(source);
+ if (entry != null) {
+ if (sourceTime != entry.modificationTime) {
+ changedSources.add(source);
+ PerformanceStatistics
+ .cacheConsistencyValidationStatistics.numOfModified++;
+ }
+ if (entry.exception != null) {
+ if (sourceTime == -1) {
+ missingSources.add(source);
PerformanceStatistics
.cacheConsistencyValidationStatistics.numOfModified++;
}
- if (entry.exception != null) {
- if (sourceTime == -1) {
- missingSources.add(source);
- PerformanceStatistics
- .cacheConsistencyValidationStatistics.numOfModified++;
- }
- }
}
}
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698