Index: sdk/lib/async/future_impl.dart |
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart |
index be0b7a23229fff9d0acee3ff592698f11332e542..738a9bba9aa368a0f5ce12bbac26820c7118fe2d 100644 |
--- a/sdk/lib/async/future_impl.dart |
+++ b/sdk/lib/async/future_impl.dart |
@@ -10,9 +10,11 @@ deprecatedFutureValue(_FutureImpl future) => |
abstract class _Completer<T> implements Completer<T> { |
final Future<T> future; |
Anders Johnsen
2013/07/05 17:10:50
It's okay to type this _FutureImpl, and then avoid
floitsch
2013/07/05 18:08:19
I think I once had a _FutureImpl here, but Lasse a
Lasse Reichstein Nielsen
2013/07/05 18:49:43
The argument was that is that the field is public,
|
bool _isComplete = false; |
+ final _Zone _zone = _Zone.current.fork(); |
_Completer() : future = new _FutureImpl<T>() { |
Anders Johnsen
2013/07/05 17:10:50
So Future have a Zone too, so why not just use tha
floitsch
2013/07/05 18:08:19
Right...
No need for Zones in the completer. Remov
Lasse Reichstein Nielsen
2013/07/05 18:49:43
My interpretation too. Can't you just use future._
floitsch
2013/07/05 18:51:46
Completer.zone is already removed.
|
_FutureImpl futureImpl = future; |
+ _zone.expectCallback(); |
futureImpl._zone.expectCallback(); |
} |
@@ -23,6 +25,7 @@ abstract class _Completer<T> implements Completer<T> { |
if (_isComplete) throw new StateError("Future already completed"); |
_isComplete = true; |
_FutureImpl futureImpl = future; |
+ _zone.cancelCallbackExpectation(); |
futureImpl._zone.cancelCallbackExpectation(); |
_setFutureValue(value); |
} |
@@ -35,11 +38,13 @@ abstract class _Completer<T> implements Completer<T> { |
_attachStackTrace(error, stackTrace); |
} |
_FutureImpl futureImpl = future; |
- if (futureImpl._inSameErrorZone(_Zone.current)) { |
+ if (futureImpl._inSameErrorZone(_zone)) { |
Anders Johnsen
2013/07/05 17:10:50
futureImpl._zone and below?
floitsch
2013/07/05 18:08:19
Actually it must be the same zone now, so I could
|
+ _zone.cancelCallbackExpectation(); |
futureImpl._zone.cancelCallbackExpectation(); |
_setFutureError(error); |
} else { |
- _Zone.current.handleUncaughtError(error); |
+ _zone.cancelCallbackExpectation(); |
+ _zone.handleUncaughtError(error); |
} |
} |