Chromium Code Reviews| 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 { |