| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 * arguments on the way. | 57 * arguments on the way. |
| 58 * | 58 * |
| 59 * *The `runAsync` handler is deprecated. Use `scheduleMicrotask` instead.* | 59 * *The `runAsync` handler is deprecated. Use `scheduleMicrotask` instead.* |
| 60 */ | 60 */ |
| 61 abstract class ZoneSpecification { | 61 abstract class ZoneSpecification { |
| 62 /** | 62 /** |
| 63 * Creates a specification with the provided handlers. | 63 * Creates a specification with the provided handlers. |
| 64 */ | 64 */ |
| 65 const factory ZoneSpecification({ | 65 const factory ZoneSpecification({ |
| 66 dynamic handleUncaughtError(Zone self, ZoneDelegate parent, Zone zone, | 66 dynamic handleUncaughtError(Zone self, ZoneDelegate parent, Zone zone, |
| 67 error, StackTrace stackTrace): null, | 67 error, StackTrace stackTrace), |
| 68 dynamic run(Zone self, ZoneDelegate parent, Zone zone, f()): null, | 68 dynamic run(Zone self, ZoneDelegate parent, Zone zone, f()), |
| 69 dynamic runUnary( | 69 dynamic runUnary( |
| 70 Zone self, ZoneDelegate parent, Zone zone, f(arg), arg): null, | 70 Zone self, ZoneDelegate parent, Zone zone, f(arg), arg), |
| 71 dynamic runBinary(Zone self, ZoneDelegate parent, Zone zone, | 71 dynamic runBinary(Zone self, ZoneDelegate parent, Zone zone, |
| 72 f(arg1, arg2), arg1, arg2): null, | 72 f(arg1, arg2), arg1, arg2), |
| 73 ZoneCallback registerCallback( | 73 ZoneCallback registerCallback( |
| 74 Zone self, ZoneDelegate parent, Zone zone, f()): null, | 74 Zone self, ZoneDelegate parent, Zone zone, f()), |
| 75 ZoneUnaryCallback registerUnaryCallback( | 75 ZoneUnaryCallback registerUnaryCallback( |
| 76 Zone self, ZoneDelegate parent, Zone zone, f(arg)): null, | 76 Zone self, ZoneDelegate parent, Zone zone, f(arg)), |
| 77 ZoneBinaryCallback registerBinaryCallback( | 77 ZoneBinaryCallback registerBinaryCallback( |
| 78 Zone self, ZoneDelegate parent, Zone zone, f(arg1, arg2)): null, | 78 Zone self, ZoneDelegate parent, Zone zone, f(arg1, arg2)), |
| 79 void scheduleMicrotask( | 79 void scheduleMicrotask( |
| 80 Zone self, ZoneDelegate parent, Zone zone, f()): null, | 80 Zone self, ZoneDelegate parent, Zone zone, f()), |
| 81 void runAsync( | 81 void runAsync( |
| 82 Zone self, ZoneDelegate parent, Zone zone, f()): null, | 82 Zone self, ZoneDelegate parent, Zone zone, f()), |
| 83 Timer createTimer(Zone self, ZoneDelegate parent, Zone zone, | 83 Timer createTimer(Zone self, ZoneDelegate parent, Zone zone, |
| 84 Duration duration, void f()): null, | 84 Duration duration, void f()), |
| 85 Timer createPeriodicTimer(Zone self, ZoneDelegate parent, Zone zone, | 85 Timer createPeriodicTimer(Zone self, ZoneDelegate parent, Zone zone, |
| 86 Duration period, void f(Timer timer)): null, | 86 Duration period, void f(Timer timer)), |
| 87 void print(Zone self, ZoneDelegate parent, Zone zone, String line): null, | 87 void print(Zone self, ZoneDelegate parent, Zone zone, String line), |
| 88 Zone fork(Zone self, ZoneDelegate parent, Zone zone, | 88 Zone fork(Zone self, ZoneDelegate parent, Zone zone, |
| 89 ZoneSpecification specification, Map zoneValues): null | 89 ZoneSpecification specification, Map zoneValues) |
| 90 }) = _ZoneSpecification; | 90 }) = _ZoneSpecification; |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * Creates a specification from [other] with the provided handlers overriding | 93 * Creates a specification from [other] with the provided handlers overriding |
| 94 * the ones in [other]. | 94 * the ones in [other]. |
| 95 */ | 95 */ |
| 96 factory ZoneSpecification.from(ZoneSpecification other, { | 96 factory ZoneSpecification.from(ZoneSpecification other, { |
| 97 dynamic handleUncaughtError(Zone self, ZoneDelegate parent, Zone zone, | 97 dynamic handleUncaughtError(Zone self, ZoneDelegate parent, Zone zone, |
| 98 error, StackTrace stackTrace): null, | 98 error, StackTrace stackTrace): null, |
| 99 dynamic run(Zone self, ZoneDelegate parent, Zone zone, f()): null, | 99 dynamic run(Zone self, ZoneDelegate parent, Zone zone, f()): null, |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 ZoneSpecification specification = | 1013 ZoneSpecification specification = |
| 1014 new ZoneSpecification(handleUncaughtError: errorHandler, | 1014 new ZoneSpecification(handleUncaughtError: errorHandler, |
| 1015 scheduleMicrotask: asyncHandler); | 1015 scheduleMicrotask: asyncHandler); |
| 1016 Zone zone = Zone.current.fork(specification: specification); | 1016 Zone zone = Zone.current.fork(specification: specification); |
| 1017 if (onError != null) { | 1017 if (onError != null) { |
| 1018 return zone.runGuarded(body); | 1018 return zone.runGuarded(body); |
| 1019 } else { | 1019 } else { |
| 1020 return zone.run(body); | 1020 return zone.run(body); |
| 1021 } | 1021 } |
| 1022 } | 1022 } |
| OLD | NEW |