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

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

Issue 2132073003: Validate cache consistency asynchronously. Compute modification times of physical files in a separa… (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
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) {

Powered by Google App Engine
This is Rietveld 408576698