Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: sdk/lib/async/zone.dart

Issue 637893002: Use a _FutureListener separate from the _Future to hold listeners. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't check that source is complete, it always is. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 _ZoneFunction get _createTimer; 600 _ZoneFunction get _createTimer;
601 _ZoneFunction get _createPeriodicTimer; 601 _ZoneFunction get _createPeriodicTimer;
602 _ZoneFunction get _print; 602 _ZoneFunction get _print;
603 _ZoneFunction get _fork; 603 _ZoneFunction get _fork;
604 _ZoneFunction get _handleUncaughtError; 604 _ZoneFunction get _handleUncaughtError;
605 _Zone get parent; 605 _Zone get parent;
606 _ZoneDelegate get _delegate; 606 _ZoneDelegate get _delegate;
607 Map get _map; 607 Map get _map;
608 608
609 bool inSameErrorZone(Zone otherZone) { 609 bool inSameErrorZone(Zone otherZone) {
610 return identical(errorZone, otherZone.errorZone); 610 return identical(this, otherZone) ||
611 identical(errorZone, otherZone.errorZone);
611 } 612 }
612 } 613 }
613 614
614 class _CustomZone extends _Zone { 615 class _CustomZone extends _Zone {
615 // The actual zone and implementation of each of these 616 // The actual zone and implementation of each of these
616 // inheritable zone functions. 617 // inheritable zone functions.
617 _ZoneFunction _runUnary; 618 _ZoneFunction _runUnary;
618 _ZoneFunction _run; 619 _ZoneFunction _run;
619 _ZoneFunction _runBinary; 620 _ZoneFunction _runBinary;
620 _ZoneFunction _registerCallback; 621 _ZoneFunction _registerCallback;
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
933 ZoneBinaryCallback _rootRegisterBinaryCallback( 934 ZoneBinaryCallback _rootRegisterBinaryCallback(
934 Zone self, ZoneDelegate parent, Zone zone, f(arg1, arg2)) { 935 Zone self, ZoneDelegate parent, Zone zone, f(arg1, arg2)) {
935 return f; 936 return f;
936 } 937 }
937 938
938 AsyncError _rootErrorCallback(Zone self, ZoneDelegate parent, Zone zone, 939 AsyncError _rootErrorCallback(Zone self, ZoneDelegate parent, Zone zone,
939 Object error, StackTrace stackTrace) => null; 940 Object error, StackTrace stackTrace) => null;
940 941
941 void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) { 942 void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) {
942 if (!identical(_ROOT_ZONE, zone)) { 943 if (!identical(_ROOT_ZONE, zone)) {
943 f = zone.bindCallback(f); 944 bool hasErrorHandler = !_ROOT_ZONE.inSameErrorZone(zone);
945 f = zone.bindCallback(f, runGuarded: hasErrorHandler);
944 } 946 }
945 _scheduleAsyncCallback(f); 947 _scheduleAsyncCallback(f);
946 } 948 }
947 949
948 Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone, 950 Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone,
949 Duration duration, void callback()) { 951 Duration duration, void callback()) {
950 if (!identical(_ROOT_ZONE, zone)) { 952 if (!identical(_ROOT_ZONE, zone)) {
951 callback = zone.bindCallback(callback); 953 callback = zone.bindCallback(callback);
952 } 954 }
953 return Timer._createTimer(duration, callback); 955 return Timer._createTimer(duration, callback);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 handleUncaughtError: errorHandler); 1244 handleUncaughtError: errorHandler);
1243 } 1245 }
1244 Zone zone = Zone.current.fork(specification: zoneSpecification, 1246 Zone zone = Zone.current.fork(specification: zoneSpecification,
1245 zoneValues: zoneValues); 1247 zoneValues: zoneValues);
1246 if (onError != null) { 1248 if (onError != null) {
1247 return zone.runGuarded(body); 1249 return zone.runGuarded(body);
1248 } else { 1250 } else {
1249 return zone.run(body); 1251 return zone.run(body);
1250 } 1252 }
1251 } 1253 }
OLDNEW
« sdk/lib/async/future_impl.dart ('K') | « sdk/lib/async/schedule_microtask.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698