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

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

Issue 891293003: Store zone in microtask entry. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix type assertion. Don't store zone if using zone.bind. Created 5 years, 8 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
« no previous file with comments | « sdk/lib/async/schedule_microtask.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 return f; 936 return f;
937 } 937 }
938 938
939 AsyncError _rootErrorCallback(Zone self, ZoneDelegate parent, Zone zone, 939 AsyncError _rootErrorCallback(Zone self, ZoneDelegate parent, Zone zone,
940 Object error, StackTrace stackTrace) => null; 940 Object error, StackTrace stackTrace) => null;
941 941
942 void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) { 942 void _rootScheduleMicrotask(Zone self, ZoneDelegate parent, Zone zone, f()) {
943 if (!identical(_ROOT_ZONE, zone)) { 943 if (!identical(_ROOT_ZONE, zone)) {
944 bool hasErrorHandler = !_ROOT_ZONE.inSameErrorZone(zone); 944 bool hasErrorHandler = !_ROOT_ZONE.inSameErrorZone(zone);
945 f = zone.bindCallback(f, runGuarded: hasErrorHandler); 945 f = zone.bindCallback(f, runGuarded: hasErrorHandler);
946 // Use root zone as event zone if the function is already bound.
947 zone = _ROOT_ZONE;
946 } 948 }
947 _scheduleAsyncCallback(f); 949 _scheduleAsyncCallback(new _AsyncCallbackEntry(f, zone));
948 } 950 }
949 951
950 Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone, 952 Timer _rootCreateTimer(Zone self, ZoneDelegate parent, Zone zone,
951 Duration duration, void callback()) { 953 Duration duration, void callback()) {
952 if (!identical(_ROOT_ZONE, zone)) { 954 if (!identical(_ROOT_ZONE, zone)) {
953 callback = zone.bindCallback(callback); 955 callback = zone.bindCallback(callback);
954 } 956 }
955 return Timer._createTimer(duration, callback); 957 return Timer._createTimer(duration, callback);
956 } 958 }
957 959
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 handleUncaughtError: errorHandler); 1246 handleUncaughtError: errorHandler);
1245 } 1247 }
1246 Zone zone = Zone.current.fork(specification: zoneSpecification, 1248 Zone zone = Zone.current.fork(specification: zoneSpecification,
1247 zoneValues: zoneValues); 1249 zoneValues: zoneValues);
1248 if (onError != null) { 1250 if (onError != null) {
1249 return zone.runGuarded(body); 1251 return zone.runGuarded(body);
1250 } else { 1252 } else {
1251 return zone.run(body); 1253 return zone.run(body);
1252 } 1254 }
1253 } 1255 }
OLDNEW
« no previous file with comments | « sdk/lib/async/schedule_microtask.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698