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

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

Issue 15764003: Add Zone support for Timers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix bug and add 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 2802e40d55ec75e41a0426a65abe5babd6b642c1..49e80da3c7bf981f9ab0ba7ef43359a410a3edaa 100644
--- a/sdk/lib/async/event_loop.dart
+++ b/sdk/lib/async/event_loop.dart
@@ -25,6 +25,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.
*
@@ -45,13 +55,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