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

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

Issue 299513003: improve analysis server notifications (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: remove analysis.complete notification Created 6 years, 7 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
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_server.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1bc01d584eacc2664d559b8d0b8db4b6433931e7..af8c32eb0f8222ccb7850c817e7e32e3c3322286 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -68,6 +68,11 @@ class AnalysisServer {
final Map<String, AnalysisContext> contextMap = new Map<String, AnalysisContext>();
/**
+ * A table mapping analysis contexts to the context id's associated with them.
+ */
+ final Map<AnalysisContext, String> contextIdMap = new Map<AnalysisContext, String>();
+
+ /**
* A list of the analysis contexts for which analysis work needs to be
* performed.
*
@@ -162,8 +167,10 @@ class AnalysisServer {
// Look for a context that has work to be done and then perform one task.
//
List<ChangeNotice> notices = null;
+ String contextId;
try {
AnalysisContext context = contextWorkQueue[0];
+ contextId = contextIdMap[context];
AnalysisResult result = context.performAnalysisTask();
notices = result.changeNotices;
} finally {
@@ -183,17 +190,18 @@ class AnalysisServer {
}
}
if (notices != null) {
- sendNotices(notices);
+ sendNotices(contextId, notices);
}
}
/**
* Send the information in the given list of notices back to the client.
*/
- void sendNotices(List<ChangeNotice> notices) {
+ void sendNotices(String contextId, List<ChangeNotice> notices) {
for (int i = 0; i < notices.length; i++) {
ChangeNotice notice = notices[i];
Notification notification = new Notification(ERROR_NOTIFICATION_NAME);
+ notification.setParameter(CONTEXT_ID_PARAM, contextId);
notification.setParameter(SOURCE_PARAM, notice.source.encoding);
notification.setParameter(ERRORS_PARAM, notice.errors.map(
errorToJson).toList());
« no previous file with comments | « no previous file | pkg/analysis_server/lib/src/domain_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698