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

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

Issue 887793003: Avoid redundant notifications when a file is analyzed in multiple contexts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 8ea73ae7b7d175cf1a66a4377c4583dec6966f65..07a4fdc1e0c3f87c3c9531527cc064b16e093789 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -173,6 +173,16 @@ class PerformAnalysisOperation extends ServerOperation {
ChangeNotice notice = notices[i];
Source source = notice.source;
String file = source.fullName;
+ // Only send notifications if the current context is the preferred
+ // context for the file. This avoids redundant notification messages
+ // being sent to the client (see dartbug.com/22210).
+ // TODO(paulberry): note that there is a small risk that this will cause
+ // notifications to be lost if the preferred context for a file changes
+ // while analysis is in progress (e.g. because the client sent an
+ // analysis.setAnalysisRoots message).
+ if (server.getAnalysisContext(file) != context) {
+ continue;
+ }
// Dart
CompilationUnit parsedDartUnit = notice.parsedDartUnit;
CompilationUnit resolvedDartUnit = notice.resolvedDartUnit;

Powered by Google App Engine
This is Rietveld 408576698