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

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

Issue 14973006: Zone support for Futures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: mostly tests. Created 7 years, 7 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
Index: sdk/lib/async/event_loop.dart
diff --git a/sdk/lib/async/event_loop.dart b/sdk/lib/async/event_loop.dart
index 3ceccd2c95766d8c04d365f52c388a409c46b6bd..8d0a0425efc5612307f7d58b22d7a2f275bbb07e 100644
--- a/sdk/lib/async/event_loop.dart
+++ b/sdk/lib/async/event_loop.dart
@@ -38,6 +38,16 @@ void _asyncRunCallback() {
_callbacksAreEnqueued = false;
}
+void _scheduleAsyncCallback(callback) {
+ // Optimizing a group of Timer.run callbacks to be executed in the
+ // same Timer callback.
+ _asyncCallbacks.add(callback);
+ if (!_callbacksAreEnqueued) {
+ _AsyncRun._enqueueImmediate(_asyncRunCallback);
+ _callbacksAreEnqueued = true;
+ }
+}
+
/**
* Runs the given [callback] asynchronously.
*
@@ -58,13 +68,7 @@ void _asyncRunCallback() {
* }
*/
void runAsync(void callback()) {
- // Optimizing a group of Timer.run callbacks to be executed in the
- // same Timer callback.
- _asyncCallbacks.add(callback);
- if (!_callbacksAreEnqueued) {
- _AsyncRun._enqueueImmediate(_asyncRunCallback);
- _callbacksAreEnqueued = true;
- }
+ _Zone._current.runAsync(callback);
}
class _AsyncRun {

Powered by Google App Engine
This is Rietveld 408576698