OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.async; | 5 part of dart.async; |
6 | 6 |
7 typedef dynamic ZoneCallback(); | 7 typedef dynamic ZoneCallback(); |
8 typedef dynamic ZoneUnaryCallback(arg); | 8 typedef dynamic ZoneUnaryCallback(arg); |
9 typedef dynamic ZoneBinaryCallback(arg1, arg2); | 9 typedef dynamic ZoneBinaryCallback(arg1, arg2); |
10 | 10 |
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 AsyncError _rootErrorCallback(Zone self, ZoneDelegate parent, Zone zone, | 951 AsyncError _rootErrorCallback(Zone self, ZoneDelegate parent, Zone zone, |
952 Object error, StackTrace stackTrace) => null; | 952 Object error, StackTrace stackTrace) => null; |
953 | 953 |
954 void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) { | 954 void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) { |
955 if (!identical(_ROOT_ZONE, zone)) { | 955 if (!identical(_ROOT_ZONE, zone)) { |
956 bool hasErrorHandler = !_ROOT_ZONE.inSameErrorZone(zone); | 956 bool hasErrorHandler = !_ROOT_ZONE.inSameErrorZone(zone); |
957 f = zone.bindCallback(f, runGuarded: hasErrorHandler); | 957 f = zone.bindCallback(f, runGuarded: hasErrorHandler); |
958 // Use root zone as event zone if the function is already bound. | 958 // Use root zone as event zone if the function is already bound. |
959 zone = _ROOT_ZONE; | 959 zone = _ROOT_ZONE; |
960 } | 960 } |
961 _scheduleAsyncCallback(new _AsyncCallbackEntry(f, zone)); | 961 _scheduleAsyncCallback(f); |
962 } | 962 } |
963 | 963 |
964 Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone, | 964 Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone, |
965 Duration duration, void callback()) { | 965 Duration duration, void callback()) { |
966 if (!identical(_ROOT_ZONE, zone)) { | 966 if (!identical(_ROOT_ZONE, zone)) { |
967 callback = zone.bindCallback(callback); | 967 callback = zone.bindCallback(callback); |
968 } | 968 } |
969 return Timer._createTimer(duration, callback); | 969 return Timer._createTimer(duration, callback); |
970 } | 970 } |
971 | 971 |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1238 handleUncaughtError: errorHandler); | 1238 handleUncaughtError: errorHandler); |
1239 } | 1239 } |
1240 Zone zone = Zone.current.fork(specification: zoneSpecification, | 1240 Zone zone = Zone.current.fork(specification: zoneSpecification, |
1241 zoneValues: zoneValues); | 1241 zoneValues: zoneValues); |
1242 if (onError != null) { | 1242 if (onError != null) { |
1243 return zone.runGuarded(body); | 1243 return zone.runGuarded(body); |
1244 } else { | 1244 } else { |
1245 return zone.run(body); | 1245 return zone.run(body); |
1246 } | 1246 } |
1247 } | 1247 } |
OLD | NEW |