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

Unified Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 1195183002: Move cache consistency validation into Analysis Server. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/lib/src/operation/operation_analysis.dart
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index 918deb8f710dd72d834a28b258eacc6f6d3f7705..dca1c066f22f43278216d96e4a6853bcf0659546 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -240,7 +240,17 @@ class PerformAnalysisOperation extends ServerOperation {
// prepare results
AnalysisResult result = context.performAnalysisTask();
List<ChangeNotice> notices = result.changeNotices;
+ // nothing to analyze
if (notices == null) {
+ // TODO(scheglov) Move cache validation into a separate operation.
+ bool cacheIsInconsistent = _validateCacheConsistency();
+ print('cacheIsInconsistent: $cacheIsInconsistent');
Brian Wilkerson 2015/06/21 15:52:39 Remove debug line? If we want to capture this we s
+ // there was a cache inconsistency, analyze again
+ if (cacheIsInconsistent) {
+ server.addOperation(new PerformAnalysisOperation(context, true));
+ return;
+ }
+ // analysis is done
setCacheSize(context, IDLE_CACHE_SIZE);
server.sendContextAnalysisDoneNotifications(
context, AnalysisDoneReason.COMPLETE);
@@ -299,6 +309,21 @@ class PerformAnalysisOperation extends ServerOperation {
}
}
}
+
+ /**
+ * Checks whether all of the cache entries of [context] are consistent.
+ * If there is an inconsistent entry, returns `true`.
+ */
+ bool _validateCacheConsistency() {
Brian Wilkerson 2015/06/21 15:52:39 I'd move this method to AnalysisContext. I'd rathe
+ bool hasInconsistentEntries = false;
+ InternalAnalysisContext context = this.context;
+ for (Source source in context.sources) {
+ if (context.validateSourceCacheConsistency(source)) {
+ hasInconsistentEntries = true;
+ }
+ }
+ return hasInconsistentEntries;
+ }
}
class _DartHighlightsOperation extends _DartNotificationOperation {
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698