Chromium Code Reviews| Index: pkg/analyzer/lib/src/dart/analysis/status.dart |
| diff --git a/pkg/analyzer/lib/src/dart/analysis/status.dart b/pkg/analyzer/lib/src/dart/analysis/status.dart |
| index e70de686623aa72f3eafdff29498bc62f44a741c..b108eafcb8c81fd57bd6d78d84a24eb682290fa0 100644 |
| --- a/pkg/analyzer/lib/src/dart/analysis/status.dart |
| +++ b/pkg/analyzer/lib/src/dart/analysis/status.dart |
| @@ -89,10 +89,22 @@ class StatusSupport { |
| Stream<AnalysisStatus> get stream => _statusController.stream; |
| /** |
| + * Prepare for the driver to start analyzing, but do not notify the [stream] |
| + * yet. |
| + * |
| + * A call to [preTransitionToAnalyzing] has the same effect on [waitForIdle] |
| + * as a call to [transitionToAnalyzing], but it has no effect on the [stream]. |
| + */ |
| + void preTransitionToAnalyzing() { |
| + _idleCompleter ??= new Completer<Null>(); |
| + } |
| + |
| + /** |
| * Send a notifications to the [stream] that the driver started analyzing. |
|
scheglov
2017/02/01 00:35:58
Now probably that "a driver" started analyzing.
Or
Paul Berry
2017/02/01 17:17:34
Done.
|
| */ |
| void transitionToAnalyzing() { |
| if (_currentStatus != AnalysisStatus.ANALYZING) { |
| + preTransitionToAnalyzing(); |
| _currentStatus = AnalysisStatus.ANALYZING; |
| _statusController.add(AnalysisStatus.ANALYZING); |
| } |
| @@ -105,9 +117,9 @@ class StatusSupport { |
| if (_currentStatus != AnalysisStatus.IDLE) { |
| _currentStatus = AnalysisStatus.IDLE; |
| _statusController.add(AnalysisStatus.IDLE); |
| - _idleCompleter?.complete(); |
| - _idleCompleter = null; |
| } |
| + _idleCompleter?.complete(); |
| + _idleCompleter = null; |
| } |
| /** |
| @@ -117,11 +129,6 @@ class StatusSupport { |
| * immediately. |
| */ |
| Future<Null> waitForIdle() { |
| - if (_currentStatus == AnalysisStatus.IDLE) { |
| - return new Future.value(); |
| - } else { |
| - _idleCompleter ??= new Completer<Null>(); |
| - return _idleCompleter.future; |
| - } |
| + return _idleCompleter?.future ?? new Future.value(); |
| } |
| } |