| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library analysis.server; | 5 library analysis.server; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:core'; | 9 import 'dart:core'; |
| 10 import 'dart:io' as io; | 10 import 'dart:io' as io; |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 Completer _onAnalysisCompleteCompleter; | 235 Completer _onAnalysisCompleteCompleter; |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * The [Completer] that completes when the next operation is performed. | 238 * The [Completer] that completes when the next operation is performed. |
| 239 */ | 239 */ |
| 240 Completer _test_onOperationPerformedCompleter; | 240 Completer _test_onOperationPerformedCompleter; |
| 241 | 241 |
| 242 /** | 242 /** |
| 243 * The controller that is notified when analysis is started. | 243 * The controller that is notified when analysis is started. |
| 244 */ | 244 */ |
| 245 StreamController<AnalysisContext> _onAnalysisStartedController; | 245 StreamController<bool> _onAnalysisStartedController; |
| 246 | 246 |
| 247 /** | 247 /** |
| 248 * The controller that is notified when a single file has been analyzed. | 248 * The controller that is notified when a single file has been analyzed. |
| 249 */ | 249 */ |
| 250 StreamController<ChangeNotice> _onFileAnalyzedController; | 250 StreamController<ChangeNotice> _onFileAnalyzedController; |
| 251 | 251 |
| 252 /** | 252 /** |
| 253 * The controller used to notify others when priority sources change. | 253 * The controller used to notify others when priority sources change. |
| 254 */ | 254 */ |
| 255 StreamController<PriorityChangeEvent> _onPriorityChangeController; | 255 StreamController<PriorityChangeEvent> _onPriorityChangeController; |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 if (isAnalysisComplete()) { | 485 if (isAnalysisComplete()) { |
| 486 return new Future.value(); | 486 return new Future.value(); |
| 487 } | 487 } |
| 488 if (_onAnalysisCompleteCompleter == null) { | 488 if (_onAnalysisCompleteCompleter == null) { |
| 489 _onAnalysisCompleteCompleter = new Completer(); | 489 _onAnalysisCompleteCompleter = new Completer(); |
| 490 } | 490 } |
| 491 return _onAnalysisCompleteCompleter.future; | 491 return _onAnalysisCompleteCompleter.future; |
| 492 } | 492 } |
| 493 | 493 |
| 494 /** | 494 /** |
| 495 * The stream that is notified when analysis of a context is started. | 495 * The stream that is notified with `true` when analysis is started. |
| 496 */ | 496 */ |
| 497 Stream<AnalysisContext> get onAnalysisStarted { | 497 Stream<bool> get onAnalysisStarted { |
| 498 return _onAnalysisStartedController.stream; | 498 return _onAnalysisStartedController.stream; |
| 499 } | 499 } |
| 500 | 500 |
| 501 /** | 501 /** |
| 502 * The stream that is notified when contexts are added or removed. | 502 * The stream that is notified when contexts are added or removed. |
| 503 */ | 503 */ |
| 504 Stream<ContextsChangedEvent> get onContextsChanged => | 504 Stream<ContextsChangedEvent> get onContextsChanged => |
| 505 _onContextsChangedController.stream; | 505 _onContextsChangedController.stream; |
| 506 | 506 |
| 507 /** | 507 /** |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 */ | 1077 */ |
| 1078 void scheduleOperation(ServerOperation operation) { | 1078 void scheduleOperation(ServerOperation operation) { |
| 1079 addOperation(operation); | 1079 addOperation(operation); |
| 1080 _schedulePerformOperation(); | 1080 _schedulePerformOperation(); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 /** | 1083 /** |
| 1084 * Schedules analysis of the given context. | 1084 * Schedules analysis of the given context. |
| 1085 */ | 1085 */ |
| 1086 void schedulePerformAnalysisOperation(AnalysisContext context) { | 1086 void schedulePerformAnalysisOperation(AnalysisContext context) { |
| 1087 _onAnalysisStartedController.add(context); | 1087 _onAnalysisStartedController.add(true); |
| 1088 scheduleOperation(new PerformAnalysisOperation(context, false)); | 1088 scheduleOperation(new PerformAnalysisOperation(context, false)); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 /** | 1091 /** |
| 1092 * This method is called when analysis of the given [AnalysisContext] is | 1092 * This method is called when analysis of the given [AnalysisContext] is |
| 1093 * done. | 1093 * done. |
| 1094 */ | 1094 */ |
| 1095 void sendContextAnalysisDoneNotifications( | 1095 void sendContextAnalysisDoneNotifications( |
| 1096 AnalysisContext context, AnalysisDoneReason reason) { | 1096 AnalysisContext context, AnalysisDoneReason reason) { |
| 1097 Completer<AnalysisDoneReason> completer = | 1097 Completer<AnalysisDoneReason> completer = |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 AnalysisStatus analysis = new AnalysisStatus(isAnalyzing); | 1161 AnalysisStatus analysis = new AnalysisStatus(isAnalyzing); |
| 1162 channel.sendNotification( | 1162 channel.sendNotification( |
| 1163 new ServerStatusParams(analysis: analysis).toNotification()); | 1163 new ServerStatusParams(analysis: analysis).toNotification()); |
| 1164 } | 1164 } |
| 1165 | 1165 |
| 1166 /** | 1166 /** |
| 1167 * Send status notification to the client. The state of analysis is given by | 1167 * Send status notification to the client. The state of analysis is given by |
| 1168 * the [status] information. | 1168 * the [status] information. |
| 1169 */ | 1169 */ |
| 1170 void sendStatusNotificationNew(nd.AnalysisStatus status) { | 1170 void sendStatusNotificationNew(nd.AnalysisStatus status) { |
| 1171 if (status.isAnalyzing) { |
| 1172 _onAnalysisStartedController.add(true); |
| 1173 } |
| 1171 if (_onAnalysisCompleteCompleter != null && !status.isAnalyzing) { | 1174 if (_onAnalysisCompleteCompleter != null && !status.isAnalyzing) { |
| 1172 _onAnalysisCompleteCompleter.complete(); | 1175 _onAnalysisCompleteCompleter.complete(); |
| 1173 _onAnalysisCompleteCompleter = null; | 1176 _onAnalysisCompleteCompleter = null; |
| 1174 } | 1177 } |
| 1175 // Perform on-idle actions. | 1178 // Perform on-idle actions. |
| 1176 if (!status.isAnalyzing) { | 1179 if (!status.isAnalyzing) { |
| 1177 if (generalAnalysisServices | 1180 if (generalAnalysisServices |
| 1178 .contains(GeneralAnalysisService.ANALYZED_FILES)) { | 1181 .contains(GeneralAnalysisService.ANALYZED_FILES)) { |
| 1179 sendAnalysisNotificationAnalyzedFiles(this); | 1182 sendAnalysisNotificationAnalyzedFiles(this); |
| 1180 } | 1183 } |
| (...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2120 /** | 2123 /** |
| 2121 * The [PerformanceTag] for time spent in server request handlers. | 2124 * The [PerformanceTag] for time spent in server request handlers. |
| 2122 */ | 2125 */ |
| 2123 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); | 2126 static PerformanceTag serverRequests = new PerformanceTag('serverRequests'); |
| 2124 | 2127 |
| 2125 /** | 2128 /** |
| 2126 * The [PerformanceTag] for time spent in split store microtasks. | 2129 * The [PerformanceTag] for time spent in split store microtasks. |
| 2127 */ | 2130 */ |
| 2128 static PerformanceTag splitStore = new PerformanceTag('splitStore'); | 2131 static PerformanceTag splitStore = new PerformanceTag('splitStore'); |
| 2129 } | 2132 } |
| OLD | NEW |