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

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

Issue 23875032: Expose Zones. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 7 years, 3 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/async.dart ('k') | sdk/lib/async/future.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/event_loop.dart
diff --git a/sdk/lib/async/event_loop.dart b/sdk/lib/async/event_loop.dart
index 9462460ecee20605358ec6f0bd7d8e6ae8abd039..94137da655b61c61739078757e06e6c8a36c0a9d 100644
--- a/sdk/lib/async/event_loop.dart
+++ b/sdk/lib/async/event_loop.dart
@@ -55,8 +55,14 @@ void _scheduleAsyncCallback(callback) {
* }
*/
void runAsync(void callback()) {
- _Zone currentZone = _Zone._current;
- currentZone.runAsync(callback, currentZone);
+ if (Zone.current == Zone.ROOT) {
+ // No need to bind the callback. We know that the root's runAsync will
+ // be invoked in the root zone.
+ Zone.current.scheduleMicrotask(callback);
+ return;
+ }
+ Zone.current.scheduleMicrotask(
+ Zone.current.bindCallback(callback, runGuarded: true));
}
class _AsyncRun {
« no previous file with comments | « sdk/lib/async/async.dart ('k') | sdk/lib/async/future.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698