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

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

Issue 87283003: Make the root zone's schduleMicrotask and create[Periodic]Timer bind the callback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Changed tests. Created 7 years, 1 month 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/zone.dart
diff --git a/sdk/lib/async/zone.dart b/sdk/lib/async/zone.dart
index 471a7d359e95def8e538e8f9e8a8ba0e3a7713e9..88b30549d29a8dde06d6b79b28047fc9d2f3f658 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -359,7 +359,7 @@ abstract class Zone {
f(arg1, arg2), { bool runGuarded: true });
/**
- * Runs [f] asynchronously.
+ * Runs [f] asynchronously in this zone.
*/
void scheduleMicrotask(void f());
@@ -732,20 +732,29 @@ ZoneBinaryCallback _rootRegisterBinaryCallback(
}
void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) {
+ if (Zone.ROOT != zone) {
+ f = zone.bindCallback(f);
+ }
_scheduleAsyncCallback(f);
}
Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone,
Duration duration, void callback()) {
+ if (Zone.ROOT != zone) {
+ callback = zone.bindCallback(callback);
+ }
return _createTimer(duration, callback);
}
Timer _rootCreatePeriodicTimer(
Zone self, ZoneDelegate parent, Zone zone,
Duration duration, void callback(Timer timer)) {
+ if (Zone.ROOT != zone) {
+ callback = zone.bindUnaryCallback(callback);
+ }
return _createPeriodicTimer(duration, callback);
-
}
+
void _rootPrint(Zone self, ZoneDelegate parent, Zone zone, String line) {
printToConsole(line);
}

Powered by Google App Engine
This is Rietveld 408576698