| 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 1420 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1431  *       new Future(() { throw "asynchronous error"; }); | 1431  *       new Future(() { throw "asynchronous error"; }); | 
| 1432  *     }, onError: print);  // Will print "asynchronous error". | 1432  *     }, onError: print);  // Will print "asynchronous error". | 
| 1433  */ | 1433  */ | 
| 1434 R runZoned<R>(R body(), | 1434 R runZoned<R>(R body(), | 
| 1435     {Map zoneValues, ZoneSpecification zoneSpecification, Function onError}) { | 1435     {Map zoneValues, ZoneSpecification zoneSpecification, Function onError}) { | 
| 1436   HandleUncaughtErrorHandler errorHandler; | 1436   HandleUncaughtErrorHandler errorHandler; | 
| 1437   if (onError != null) { | 1437   if (onError != null) { | 
| 1438     errorHandler = (Zone self, ZoneDelegate parent, Zone zone, error, | 1438     errorHandler = (Zone self, ZoneDelegate parent, Zone zone, error, | 
| 1439         StackTrace stackTrace) { | 1439         StackTrace stackTrace) { | 
| 1440       try { | 1440       try { | 
| 1441         if (onError is ZoneBinaryCallback<R, Object, StackTrace>) { | 1441         // TODO(floitsch): the return type should be 'void'. | 
|  | 1442         if (onError is ZoneBinaryCallback<dynamic, Object, StackTrace>) { | 
| 1442           return self.parent.runBinary(onError, error, stackTrace); | 1443           return self.parent.runBinary(onError, error, stackTrace); | 
| 1443         } | 1444         } | 
| 1444         return self.parent.runUnary(onError, error); | 1445         return self.parent.runUnary(onError, error); | 
| 1445       } catch (e, s) { | 1446       } catch (e, s) { | 
| 1446         if (identical(e, error)) { | 1447         if (identical(e, error)) { | 
| 1447           return parent.handleUncaughtError(zone, error, stackTrace); | 1448           return parent.handleUncaughtError(zone, error, stackTrace); | 
| 1448         } else { | 1449         } else { | 
| 1449           return parent.handleUncaughtError(zone, e, s); | 1450           return parent.handleUncaughtError(zone, e, s); | 
| 1450         } | 1451         } | 
| 1451       } | 1452       } | 
| 1452     }; | 1453     }; | 
| 1453   } | 1454   } | 
| 1454   if (zoneSpecification == null) { | 1455   if (zoneSpecification == null) { | 
| 1455     zoneSpecification = | 1456     zoneSpecification = | 
| 1456         new ZoneSpecification(handleUncaughtError: errorHandler); | 1457         new ZoneSpecification(handleUncaughtError: errorHandler); | 
| 1457   } else if (errorHandler != null) { | 1458   } else if (errorHandler != null) { | 
| 1458     zoneSpecification = new ZoneSpecification.from(zoneSpecification, | 1459     zoneSpecification = new ZoneSpecification.from(zoneSpecification, | 
| 1459         handleUncaughtError: errorHandler); | 1460         handleUncaughtError: errorHandler); | 
| 1460   } | 1461   } | 
| 1461   Zone zone = Zone.current | 1462   Zone zone = Zone.current | 
| 1462       .fork(specification: zoneSpecification, zoneValues: zoneValues); | 1463       .fork(specification: zoneSpecification, zoneValues: zoneValues); | 
| 1463   if (onError != null) { | 1464   if (onError != null) { | 
| 1464     return zone.runGuarded(body); | 1465     return zone.runGuarded(body); | 
| 1465   } else { | 1466   } else { | 
| 1466     return zone.run(body); | 1467     return zone.run(body); | 
| 1467   } | 1468   } | 
| 1468 } | 1469 } | 
| OLD | NEW | 
|---|