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

Unified Diff: sdk/lib/async/zone.dart

Issue 26151004: Create _RootZone and _RootSpecification. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/zone.dart
diff --git a/sdk/lib/async/zone.dart b/sdk/lib/async/zone.dart
index 80184c2e75e67f00ef01e7c42e0f269589dbd582..be8e11439fb49e6fbdc42e9f80e0ec4b97daa65d 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -756,22 +756,80 @@ Zone _rootFork(Zone self, ZoneDelegate parent, Zone zone,
return new _CustomizedZone(zone, specification, copiedMap);
}
-const _ROOT_SPECIFICATION = const ZoneSpecification(
- handleUncaughtError: _rootHandleUncaughtError,
- run: _rootRun,
- runUnary: _rootRunUnary,
- runBinary: _rootRunBinary,
- registerCallback: _rootRegisterCallback,
- registerUnaryCallback: _rootRegisterUnaryCallback,
- registerBinaryCallback: _rootRegisterBinaryCallback,
- scheduleMicrotask: _rootScheduleMicrotask,
- createTimer: _rootCreateTimer,
- createPeriodicTimer: _rootCreatePeriodicTimer,
- fork: _rootFork
-);
-
-const _ROOT_ZONE =
- const _CustomizedZone(null, _ROOT_SPECIFICATION, const <Symbol, dynamic>{});
+class _RootZoneSpecification implements ZoneSpecification {
+ const _RootZoneSpecification();
+
+ HandleUncaughtErrorHandler get handleUncaughtError =>
+ _rootHandleUncaughtError;
+ RunHandler get run => _rootRun;
+ RunUnaryHandler get runUnary => _rootRunUnary;
+ RunBinaryHandler get runBinary => _rootRunBinary;
+ RegisterCallbackHandler get registerCallback => _rootRegisterCallback;
+ RegisterUnaryCallbackHandler get registerUnaryCallback =>
+ _rootRegisterUnaryCallback;
+ RegisterBinaryCallbackHandler get registerBinaryCallback =>
+ _rootRegisterBinaryCallback;
+ ScheduleMicrotaskHandler get scheduleMicrotask => _rootScheduleMicrotask;
+ @deprecated
+ RunAsyncHandler get runAsync => null;
+ CreateTimerHandler get createTimer => _rootCreateTimer;
+ CreatePeriodicTimerHandler get createPeriodicTimer =>
+ _rootCreatePeriodicTimer;
+ ForkHandler get fork => _rootFork;
+}
+
+class _RootZone extends _CustomizedZone {
+ const _RootZone()
+ : super(null, const _RootZoneSpecification(), const <Symbol, dynamic>{});
Lasse Reichstein Nielsen 2013/10/15 12:04:07 Can you replace the map with null, since it is nev
floitsch 2013/10/15 13:06:07 Done.
+
+ Zone get _errorZone => this;
+
+ bool inSameErrorZone(Zone otherZone) => otherZone._errorZone == this;
+
+ operator [](Symbol key) => null;
+
+ // Methods that can be customized by the zone specification.
+
+ dynamic handleUncaughtError(error, StackTrace stackTrace) =>
+ _rootHandleUncaughtError(this, null, this, error, stackTrace);
+
+ Zone fork({ZoneSpecification specification, Map zoneValues}) =>
+ _rootFork(this, null, this, specification, zoneValues);
+
+ dynamic run(f()) => _rootRun(this, null, this, f);
+
+ dynamic runUnary(f(arg), arg) => _rootRunUnary(this, null, this, f, arg);
+
+ dynamic runBinary(f(arg1, arg2), arg1, arg2) =>
+ _rootRunBinary(this, null, this, f, arg1, arg2);
+
+ ZoneCallback registerCallback(f()) =>
+ _rootRegisterCallback(this, null, this, f);
+
+ ZoneUnaryCallback registerUnaryCallback(f(arg)) =>
+ _rootRegisterUnaryCallback(this, null, this, f);
+
+ ZoneBinaryCallback registerBinaryCallback(f(arg1, arg2)) =>
+ _rootRegisterBinaryCallback(this, null, this, f);
+
+ void scheduleMicrotask(void f()) {
+ _rootScheduleMicrotask(this, null, this, f);
+ }
+
+ @deprecated
+ void runAsync(void f()) {
+ scheduleMicrotask(f);
+ }
+
+ Timer createTimer(Duration duration, void f()) =>
+ _rootCreateTimer(this, null, this, duration, f);
+
+ Timer createPeriodicTimer(Duration duration, void f(Timer timer)) =>
+ _rootCreatePeriodicTimer(this, null, this, duration, f);
+}
+
+const _ROOT_SPECIFICATION = const _RootZoneSpecification();
+const _ROOT_ZONE = const _RootZone();
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698