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

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

Issue 352823005: send status notification when analysis starts and ends (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/test/analysis_server_test.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 c29aa8a91f64a38f0b619a4abd10117242411ce8..686703e9b912f5ce7b1eb140bfea5bff059a859e 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -102,6 +102,12 @@ class AnalysisServer {
bool running;
/**
+ * A flag indicating the value of the 'analyzing' parameter sent in the last
+ * status message to the client.
+ */
+ bool statusAnalyzing = false;
Paul Berry 2014/06/25 19:38:16 How about if we call this "wasAnalyzing"
danrubel 2014/06/26 11:53:22 I want to convey that this field is associated wit
+
+ /**
* A list of the request handlers used to handle the requests sent to this
* server.
*/
@@ -340,6 +346,7 @@ class AnalysisServer {
}
// prepare next operation
ServerOperation operation = operationQueue.take();
+ sendStatusNotification(operation);
// perform the operation
try {
operation.perform(this);
@@ -360,19 +367,18 @@ class AnalysisServer {
}
/**
- * Send status notification to the client. The `contextId` indicates
- * the current context being analyzed or `null` if analysis is complete.
+ * Send status notification to the client. The `operation` is the operation
+ * being performed or `null` if analysis is complete.
*/
- void sendStatusNotification(String contextId) {
+ void sendStatusNotification(ServerOperation operation) {
+ // Only send status when it changes
Paul Berry 2014/06/25 19:38:16 Then this code can look like: bool isAnalyzing
danrubel 2014/06/26 11:53:22 You're right. I like it better that way. Done.
+ if (statusAnalyzing == (operation != null)) {
+ return;
+ }
+ statusAnalyzing = (operation != null);
Notification notification = new Notification(SERVER_STATUS);
Map<String, Object> analysis = new Map();
- if (contextId != null) {
- analysis['analyzing'] = true;
- // TODO(danrubel): replace contextId with real analysisTarget
- analysis['analysisTarget'] = contextId;
- } else {
- analysis['analyzing'] = false;
- }
+ analysis['analyzing'] = statusAnalyzing;
notification.params['analysis'] = analysis;
channel.sendNotification(notification);
}
« no previous file with comments | « no previous file | pkg/analysis_server/test/analysis_server_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698