Chromium Code Reviews| Index: sdk/lib/async/future_impl.dart |
| diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart |
| index 73dc35f18cf08174f802a39fd55e7ab2e1a2d862..26fbc19281c483d887472b3dc16ee87c779a77c0 100644 |
| --- a/sdk/lib/async/future_impl.dart |
| +++ b/sdk/lib/async/future_impl.dart |
| @@ -23,7 +23,6 @@ abstract class _Completer<T> implements Completer<T> { |
| if (_isComplete) throw new StateError("Future already completed"); |
| _isComplete = true; |
| _FutureImpl futureImpl = future; |
| - futureImpl._zone.cancelCallbackExpectation(); |
| _setFutureValue(value); |
| } |
| @@ -35,12 +34,7 @@ abstract class _Completer<T> implements Completer<T> { |
| _attachStackTrace(error, stackTrace); |
| } |
| _FutureImpl futureImpl = future; |
| - if (futureImpl._inSameErrorZone(_Zone.current)) { |
| - futureImpl._zone.cancelCallbackExpectation(); |
| - _setFutureError(error); |
| - } else { |
| - _Zone.current.handleUncaughtError(error); |
| - } |
| + _setFutureError(error); |
| } |
| bool get isCompleted => _isComplete; |
| @@ -50,11 +44,15 @@ class _AsyncCompleter<T> extends _Completer<T> { |
| void _setFutureValue(T value) { |
| _FutureImpl future = this.future; |
| future._asyncSetValue(value); |
| + future._zone.cancelCallbackExpectation(); |
| } |
| void _setFutureError(error) { |
| _FutureImpl future = this.future; |
| future._asyncSetError(error); |
| + // The async-error will schedule another callback, so we can cancel |
| + // the expectation without shutting down the zone. |
| + future._zone.cancelCallbackExpectation(); |
| } |
| } |
| @@ -62,11 +60,15 @@ class _SyncCompleter<T> extends _Completer<T> { |
| void _setFutureValue(T value) { |
| _FutureImpl future = this.future; |
| future._setValue(value); |
| + // The async-error will schedule another callback, so we can cancel |
| + // the expectation without shutting down the zone. |
|
Lasse Reichstein Nielsen
2013/07/12 12:53:57
Should this be in the _AsyncCompleter above?
floitsch
2013/07/12 13:11:54
Done.
|
| + future._zone.cancelCallbackExpectation(); |
| } |
| void _setFutureError(error) { |
| _FutureImpl future = this.future; |
| future._setError(error); |
| + future._zone.cancelCallbackExpectation(); |
| } |
| } |