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

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

Issue 1233003002: Only send "analysis.analyzedFiles" notification when the set of files changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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/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 228e0ae5c38313a5461b70d77c400ded69e07242..acd3a993c18c4ea94ae5e8df30c012dc44bb3c68 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -101,11 +101,24 @@ void scheduleNotificationOperations(AnalysisServer server, String file,
void sendAnalysisNotificationAnalyzedFiles(AnalysisServer server) {
_sendNotification(server, () {
+ // TODO(paulberry): if it proves to be too inefficient to recompute the set
+ // of analyzed files each time analysis is complete, consider modifying the
+ // analysis engine to update this set incrementally as analysis is
+ // performed.
LibraryDependencyCollector collector =
new LibraryDependencyCollector(server.getAnalysisContexts().toList());
- Set<String> directories = collector.collectLibraryDependencies();
+ Set<String> analyzedFiles = collector.collectLibraryDependencies();
+ Set<String> prevAnalyzedFiles = server.prevAnalyzedFiles;
+ if (prevAnalyzedFiles != null &&
+ prevAnalyzedFiles.length == analyzedFiles.length &&
+ prevAnalyzedFiles.difference(analyzedFiles).isEmpty) {
+ // No change to the set of analyzed files. No need to send another
+ // notification.
+ return;
+ }
+ server.prevAnalyzedFiles = analyzedFiles;
protocol.AnalysisAnalyzedFilesParams params =
- new protocol.AnalysisAnalyzedFilesParams(directories.toList());
+ new protocol.AnalysisAnalyzedFilesParams(analyzedFiles.toList());
server.sendNotification(params.toNotification());
});
}

Powered by Google App Engine
This is Rietveld 408576698