Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: sdk/lib/async/future_impl.dart

Issue 12213092: Rework Timer interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/async/future.dart ('k') | sdk/lib/async/stream_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/future_impl.dart
diff --git a/sdk/lib/async/future_impl.dart b/sdk/lib/async/future_impl.dart
index 53ba3f3e34768b02c37baa9be0070217e7035f56..8df3d4e612fdfc016a166ebe0cd2f4a8bec3d428 100644
--- a/sdk/lib/async/future_impl.dart
+++ b/sdk/lib/async/future_impl.dart
@@ -179,14 +179,14 @@ class _FutureImpl<T> implements Future<T> {
_addListener(whenFuture);
} else if (_hasValue) {
T value = _resultOrListeners;
- new Timer(0, (_) {
+ Timer.run(() {
whenFuture._sendValue(value);
});
} else {
assert(_hasError);
_clearUnhandledError();
AsyncError error = _resultOrListeners;
- new Timer(0, (_) {
+ Timer.run(() {
whenFuture._sendError(error);
});
}
@@ -198,7 +198,7 @@ class _FutureImpl<T> implements Future<T> {
assert(_hasValue);
_ThenFuture thenFuture = new _ThenFuture(onValue);
T value = _resultOrListeners;
- new Timer(0, (_) { thenFuture._sendValue(value); });
+ Timer.run(() { thenFuture._sendValue(value); });
return thenFuture;
}
@@ -208,7 +208,7 @@ class _FutureImpl<T> implements Future<T> {
_clearUnhandledError();
AsyncError error = _resultOrListeners;
_CatchErrorFuture errorFuture = new _CatchErrorFuture(onError, test);
- new Timer(0, (_) { errorFuture._sendError(error); });
+ Timer.run(() { errorFuture._sendError(error); });
return errorFuture;
}
@@ -248,7 +248,7 @@ class _FutureImpl<T> implements Future<T> {
_state |= _UNHANDLED_ERROR;
// Wait for the rest of the current event's duration to see
// if a subscriber is added to handle the error.
- new Timer(0, (_) {
+ Timer.run(() {
if (_hasUnhandledError) {
// No error handler has been added since the error was set.
_clearUnhandledError();
« no previous file with comments | « sdk/lib/async/future.dart ('k') | sdk/lib/async/stream_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698