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

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

Issue 23054006: for discussion: support for zones in DOM events (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | 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 bea3fc24b1ef6f245b169b59bc1eed7ffa415881..655aefda5b4a313aeb5d80b908c980320e5050a0 100644
--- a/sdk/lib/async/zone.dart
+++ b/sdk/lib/async/zone.dart
@@ -130,6 +130,11 @@ abstract class _Zone {
* This usually means that the [child] has finished executing and is done.
*/
void _removeChild(_Zone child);
+
+ /**
+ * True if this is the default zone, otherwise false.
+ */
+ bool get isDefault;
}
/**
@@ -157,6 +162,8 @@ class _ZoneBase implements _Zone {
assert(this is _DefaultZone);
}
+ bool get isDefault => false;
+
_Zone get _errorZone => _parentZone._errorZone;
void handleUncaughtError(error) {
@@ -321,6 +328,8 @@ class _ZoneBase implements _Zone {
class _DefaultZone extends _ZoneBase {
_DefaultZone() : super._defaultZone();
+ bool get isDefault => true;
+
_Zone get _errorZone => this;
handleUncaughtError(error) {
@@ -556,3 +565,16 @@ runZonedExperimental(body(),
_CatchErrorsZone zone = new _CatchErrorsZone(_Zone._current, onError, onDone);
return zone.runWaitForCompletion(body);
}
+
+/**
+ * Gets the current zone. See [runZonedExperimental].
+ *
+ * *Warning*: all Zone APIs are subject to change. Your code may break in the
+ * future with [NoSuchMethodError] or cause have other unexpected behavior.
+ */
+// TODO(jmesserly): how do we expose only the features that dart:html needs?
+// Crazy idea: move EventStreamSubscription to be an abstract base class in
+// dart:async (possibly renaming it) and make the calls to add and remove the
+// listener abstract. Then dart:html overrides it to use DOM addEventListener
+// and removeEventListener.
+get currentZoneExperimental => _Zone.current;
« no previous file with comments | « no previous file | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698