Index: pkg/analysis_server/lib/src/analysis_server.dart |
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart |
index 7e695a2762d8b459f62846e0663eaa077de8b1a1..ca87546ddb71458b819b48d45690b0e544eb3a46 100644 |
--- a/pkg/analysis_server/lib/src/analysis_server.dart |
+++ b/pkg/analysis_server/lib/src/analysis_server.dart |
@@ -699,23 +699,6 @@ class AnalysisServer { |
return nodes; |
} |
-// TODO(brianwilkerson) Add the following method after 'prioritySources' has |
-// been added to InternalAnalysisContext. |
-// /** |
-// * Return a list containing the full names of all of the sources that are |
-// * priority sources. |
-// */ |
-// List<String> getPriorityFiles() { |
-// List<String> priorityFiles = new List<String>(); |
-// folderMap.values.forEach((ContextDirectory directory) { |
-// InternalAnalysisContext context = directory.context; |
-// context.prioritySources.forEach((Source source) { |
-// priorityFiles.add(source.fullName); |
-// }); |
-// }); |
-// return priorityFiles; |
-// } |
- |
/** |
* Returns resolved [CompilationUnit]s of the Dart file with the given [path]. |
* |
@@ -745,6 +728,23 @@ class AnalysisServer { |
return units; |
} |
+// TODO(brianwilkerson) Add the following method after 'prioritySources' has |
+// been added to InternalAnalysisContext. |
+// /** |
+// * Return a list containing the full names of all of the sources that are |
+// * priority sources. |
+// */ |
+// List<String> getPriorityFiles() { |
+// List<String> priorityFiles = new List<String>(); |
+// folderMap.values.forEach((ContextDirectory directory) { |
+// InternalAnalysisContext context = directory.context; |
+// context.prioritySources.forEach((Source source) { |
+// priorityFiles.add(source.fullName); |
+// }); |
+// }); |
+// return priorityFiles; |
+// } |
+ |
/** |
* Handle a [request] that was read from the communication channel. |
*/ |
@@ -929,6 +929,32 @@ class AnalysisServer { |
} |
/** |
+ * Schedule cache consistency validation in [context]. |
+ * The most of the validation must be done asynchronously. |
+ */ |
+ void scheduleCacheConsistencyValidation(AnalysisContext context) { |
+ if (context is InternalAnalysisContext) { |
+ CacheConsistencyValidator validator = context.cacheConsistencyValidator; |
+ List<Source> sources = validator.getSourcesToComputeModificationTimes(); |
+ // Compute modification times and notify the validator asynchronously. |
+ new Future(() async { |
+ try { |
+ List<int> modificationTimes = |
+ await resourceProvider.getModificationTimes(sources); |
+ bool cacheInconsistencyFixed = validator |
+ .sourceModificationTimesComputed(sources, modificationTimes); |
+ if (cacheInconsistencyFixed) { |
+ scheduleOperation(new PerformAnalysisOperation(context, false)); |
+ } |
+ } catch (exception, stackTrace) { |
+ sendServerErrorNotification( |
+ 'Failed to check cache consistency', exception, stackTrace); |
+ } |
+ }); |
+ } |
+ } |
+ |
+ /** |
* Schedules execution of the given [ServerOperation]. |
*/ |
void scheduleOperation(ServerOperation operation) { |