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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 this.registerUnaryCallback: null, | 196 this.registerUnaryCallback: null, |
197 this.registerBinaryCallback: null, | 197 this.registerBinaryCallback: null, |
198 this.errorCallback: null, | 198 this.errorCallback: null, |
199 this.scheduleMicrotask: null, | 199 this.scheduleMicrotask: null, |
200 this.createTimer: null, | 200 this.createTimer: null, |
201 this.createPeriodicTimer: null, | 201 this.createPeriodicTimer: null, |
202 this.print: null, | 202 this.print: null, |
203 this.fork: null | 203 this.fork: null |
204 }); | 204 }); |
205 | 205 |
206 // TODO(13406): Enable types when dart2js supports it. | 206 final HandleUncaughtErrorHandler handleUncaughtError; |
207 final /*HandleUncaughtErrorHandler*/ handleUncaughtError; | 207 final RunHandler run; |
208 final /*RunHandler*/ run; | 208 final RunUnaryHandler runUnary; |
209 final /*RunUnaryHandler*/ runUnary; | 209 final RunBinaryHandler runBinary; |
210 final /*RunBinaryHandler*/ runBinary; | 210 final RegisterCallbackHandler registerCallback; |
211 final /*RegisterCallbackHandler*/ registerCallback; | 211 final RegisterUnaryCallbackHandler registerUnaryCallback; |
212 final /*RegisterUnaryCallbackHandler*/ registerUnaryCallback; | 212 final RegisterBinaryCallbackHandler registerBinaryCallback; |
213 final /*RegisterBinaryCallbackHandler*/ registerBinaryCallback; | 213 final ErrorCallbackHandler errorCallback; |
214 final /*ErrorCallbackHandler*/ errorCallback; | 214 final ScheduleMicrotaskHandler scheduleMicrotask; |
215 final /*ScheduleMicrotaskHandler*/ scheduleMicrotask; | 215 final CreateTimerHandler createTimer; |
216 final /*CreateTimerHandler*/ createTimer; | 216 final CreatePeriodicTimerHandler createPeriodicTimer; |
217 final /*CreatePeriodicTimerHandler*/ createPeriodicTimer; | 217 final PrintHandler print; |
218 final /*PrintHandler*/ print; | 218 final ForkHandler fork; |
219 final /*ForkHandler*/ fork; | |
220 } | 219 } |
221 | 220 |
222 /** | 221 /** |
223 * This class wraps zones for delegation. | 222 * This class wraps zones for delegation. |
224 * | 223 * |
225 * When forwarding to parent zones one can't just invoke the parent zone's | 224 * When forwarding to parent zones one can't just invoke the parent zone's |
226 * exposed functions (like [Zone.run]), but one needs to provide more | 225 * exposed functions (like [Zone.run]), but one needs to provide more |
227 * information (like the zone the `run` was initiated). Zone callbacks thus | 226 * information (like the zone the `run` was initiated). Zone callbacks thus |
228 * receive more information including this [ZoneDelegate] class. When delegating | 227 * receive more information including this [ZoneDelegate] class. When delegating |
229 * to the parent zone one should go through the given instance instead of | 228 * to the parent zone one should go through the given instance instead of |
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 handleUncaughtError: errorHandler); | 1254 handleUncaughtError: errorHandler); |
1256 } | 1255 } |
1257 Zone zone = Zone.current.fork(specification: zoneSpecification, | 1256 Zone zone = Zone.current.fork(specification: zoneSpecification, |
1258 zoneValues: zoneValues); | 1257 zoneValues: zoneValues); |
1259 if (onError != null) { | 1258 if (onError != null) { |
1260 return zone.runGuarded(body); | 1259 return zone.runGuarded(body); |
1261 } else { | 1260 } else { |
1262 return zone.run(body); | 1261 return zone.run(body); |
1263 } | 1262 } |
1264 } | 1263 } |
OLD | NEW |