| 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 139048371770a77bb839b809f3741ae7d531782b..884fc91c366f8b360c70d6a3908521f005078219 100644
|
| --- a/pkg/analysis_server/lib/src/analysis_server.dart
|
| +++ b/pkg/analysis_server/lib/src/analysis_server.dart
|
| @@ -172,14 +172,14 @@ class AnalysisServer {
|
| bool _noErrorNotification;
|
|
|
| /**
|
| - * The controller that is notified when analysis is started.
|
| + * The [Completer] that completes when analysis is complete.
|
| */
|
| - StreamController<AnalysisContext> _onAnalysisStartedController;
|
| + Completer _onAnalysisCompleteCompleter;
|
|
|
| /**
|
| - * The controller that is notified when analysis is complete.
|
| + * The controller that is notified when analysis is started.
|
| */
|
| - StreamController _onAnalysisCompleteController;
|
| + StreamController<AnalysisContext> _onAnalysisStartedController;
|
|
|
| /**
|
| * The controller that is notified when a single file has been analyzed.
|
| @@ -231,7 +231,6 @@ class AnalysisServer {
|
| _noErrorNotification = analysisServerOptions.noErrorNotification;
|
| AnalysisEngine.instance.logger = new AnalysisLogger();
|
| _onAnalysisStartedController = new StreamController.broadcast();
|
| - _onAnalysisCompleteController = new StreamController.broadcast();
|
| _onFileAnalyzedController = new StreamController.broadcast();
|
| _onPriorityChangeController =
|
| new StreamController<PriorityChangeEvent>.broadcast();
|
| @@ -242,9 +241,17 @@ class AnalysisServer {
|
| }
|
|
|
| /**
|
| - * The stream that is notified when analysis is complete.
|
| + * The [Future] that completes when analysis is complete.
|
| */
|
| - Stream get onAnalysisComplete => _onAnalysisCompleteController.stream;
|
| + Future get onAnalysisComplete {
|
| + if (isAnalysisComplete()) {
|
| + return new Future.value();
|
| + }
|
| + if (_onAnalysisCompleteCompleter == null) {
|
| + _onAnalysisCompleteCompleter = new Completer();
|
| + }
|
| + return _onAnalysisCompleteCompleter.future;
|
| + }
|
|
|
| /**
|
| * The stream that is notified when analysis of a context is started.
|
| @@ -632,7 +639,10 @@ class AnalysisServer {
|
| _schedulePerformOperation();
|
| } else {
|
| sendStatusNotification(null);
|
| - _onAnalysisCompleteController.add(null);
|
| + if (_onAnalysisCompleteCompleter != null) {
|
| + _onAnalysisCompleteCompleter.complete();
|
| + _onAnalysisCompleteCompleter = null;
|
| + }
|
| }
|
| }
|
| }
|
|
|