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 R ZoneCallback<R>(); | 7 typedef R ZoneCallback<R>(); |
8 typedef R ZoneUnaryCallback<R, T>(T arg); | 8 typedef R ZoneUnaryCallback<R, T>(T arg); |
9 typedef R ZoneBinaryCallback<R, T1, T2>(T1 arg1, T2 arg2); | 9 typedef R ZoneBinaryCallback<R, T1, T2>(T1 arg1, T2 arg2); |
10 | 10 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 */ | 392 */ |
393 bool inSameErrorZone(Zone otherZone); | 393 bool inSameErrorZone(Zone otherZone); |
394 | 394 |
395 /** | 395 /** |
396 * Creates a new zone as a child of `this`. | 396 * Creates a new zone as a child of `this`. |
397 * | 397 * |
398 * The new zone uses the closures in the given [specification] to override | 398 * The new zone uses the closures in the given [specification] to override |
399 * the current's zone behavior. All specification entries that are `null` | 399 * the current's zone behavior. All specification entries that are `null` |
400 * inherit the behavior from the parent zone (`this`). | 400 * inherit the behavior from the parent zone (`this`). |
401 * | 401 * |
402 * The new zone inherits the stored values (accessed through [operator []]) | 402 * The new zone inherits the stored values (accessed through [[]]) |
403 * of this zone and updates them with values from [zoneValues], which either | 403 * of this zone and updates them with values from [zoneValues], which either |
404 * adds new values or overrides existing ones. | 404 * adds new values or overrides existing ones. |
405 * | 405 * |
406 * Note that the fork operation is interceptible. A zone can thus change | 406 * Note that the fork operation is interceptible. A zone can thus change |
407 * the zone specification (or zone values), giving the forking zone full | 407 * the zone specification (or zone values), giving the forking zone full |
408 * control over the child zone. | 408 * control over the child zone. |
409 */ | 409 */ |
410 Zone fork({ZoneSpecification specification, | 410 Zone fork({ZoneSpecification specification, |
411 Map zoneValues}); | 411 Map zoneValues}); |
412 | 412 |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 handleUncaughtError: errorHandler); | 1496 handleUncaughtError: errorHandler); |
1497 } | 1497 } |
1498 Zone zone = Zone.current.fork(specification: zoneSpecification, | 1498 Zone zone = Zone.current.fork(specification: zoneSpecification, |
1499 zoneValues: zoneValues); | 1499 zoneValues: zoneValues); |
1500 if (onError != null) { | 1500 if (onError != null) { |
1501 return zone.runGuarded(body); | 1501 return zone.runGuarded(body); |
1502 } else { | 1502 } else { |
1503 return zone.run(body); | 1503 return zone.run(body); |
1504 } | 1504 } |
1505 } | 1505 } |
OLD | NEW |