Chromium Code Reviews| 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); |
| } |