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

Unified Diff: third_party/pkg/angular/lib/core/zone.dart

Issue 1058283006: Update pubspecs and dependencies to get pkgbuild tests working. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pkg/angular/lib/core/service.dart ('k') | third_party/pkg/angular/lib/core_dom/block.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/angular/lib/core/zone.dart
diff --git a/third_party/pkg/angular/lib/core/zone.dart b/third_party/pkg/angular/lib/core/zone.dart
deleted file mode 100644
index 600b775aac78232178964cb43a85ee9ce49879d9..0000000000000000000000000000000000000000
--- a/third_party/pkg/angular/lib/core/zone.dart
+++ /dev/null
@@ -1,172 +0,0 @@
-part of angular.core;
-
-typedef void ZoneOnTurn();
-typedef void ZoneOnError(dynamic error, dynamic stacktrace,
- LongStackTrace longStacktrace);
-
-/**
- * Contains the locations of runAsync calls across VM turns.
- */
-class LongStackTrace {
- final String reason;
- final dynamic stacktrace;
- final LongStackTrace parent;
-
- LongStackTrace(this.reason, this.stacktrace, this.parent);
-
- toString() {
- List<String> frames = '${this.stacktrace}'.split('\n')
- .where((frame) =>
- frame.indexOf('(dart:') == -1 && // skip dart runtime libs
- frame.indexOf('(package:angular/zone.dart') == -1 // skip angular zone
- ).toList()..insert(0, reason);
- var parent = this.parent == null ? '' : this.parent;
- return '${frames.join("\n ")}\n$parent';
- }
-}
-
-/**
- * A better zone API which implements onTurnDone.
- */
-class NgZone {
- final async.Zone _outerZone;
- async.Zone _zone;
-
- NgZone()
- : _outerZone = async.Zone.current
- {
- _zone = _outerZone.fork(specification: new async.ZoneSpecification(
- run: _onRun,
- runUnary: _onRunUnary,
- scheduleMicrotask: _onScheduleMicrotask,
- handleUncaughtError: _uncaughtError
- ));
- }
-
-
- List _asyncQueue = [];
- bool _errorThrownFromOnRun = false;
-
- _onRunBase(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) {
- _runningInTurn++;
- try {
- return fn();
- } catch (e, s) {
- onError(e, s, _longStacktrace);
- _errorThrownFromOnRun = true;
- rethrow;
- } finally {
- _runningInTurn--;
- if (_runningInTurn == 0) _finishTurn(zone, delegate);
- }
- }
- // Called from the parent zone.
- _onRun(async.Zone self, async.ZoneDelegate delegate, async.Zone zone, fn()) =>
- _onRunBase(self, delegate, zone, () => delegate.run(zone, fn));
-
- _onRunUnary(async.Zone self, async.ZoneDelegate delegate, async.Zone zone,
- fn(args), args) =>
- _onRunBase(self, delegate, zone, () => delegate.runUnary(zone, fn, args));
-
- _onScheduleMicrotask(async.Zone self, async.ZoneDelegate delegate,
- async.Zone zone, fn()) {
- _asyncQueue.add(() => delegate.run(zone, fn));
- if (_runningInTurn == 0 && !_inFinishTurn) _finishTurn(zone, delegate);
- }
-
- _uncaughtError(async.Zone self, async.ZoneDelegate delegate, async.Zone zone,
- e, StackTrace s) {
- if (!_errorThrownFromOnRun) onError(e, s, _longStacktrace);
- _errorThrownFromOnRun = false;
- }
-
- var _inFinishTurn = false;
- _finishTurn(zone, delegate) {
- if (_inFinishTurn) return;
- _inFinishTurn = true;
- try {
- // Two loops here: the inner one runs all queued microtasks,
- // the outer runs onTurnDone (e.g. scope.digest) and then
- // any microtasks which may have been queued from onTurnDone.
- do {
- while (!_asyncQueue.isEmpty) {
- delegate.run(zone, _asyncQueue.removeAt(0));
- }
- delegate.run(zone, onTurnDone);
- } while (!_asyncQueue.isEmpty);
- } catch (e, s) {
- onError(e, s, _longStacktrace);
- _errorThrownFromOnRun = true;
- rethrow;
- } finally {
- _inFinishTurn = false;
- }
- }
-
- int _runningInTurn = 0;
-
- /**
- * A function called with any errors from the zone.
- */
- var onError = (e, s, ls) => null;
-
- /**
- * A function that is called at the end of each VM turn in which the
- * in-zone code or any runAsync callbacks were run.
- */
- var onTurnDone = () => null; // Type was ZoneOnTurn: dartbug 13519
-
- /**
- * A function that is called when uncaught errors are thrown inside the zone.
- */
- // var onError = (dynamic e, dynamic s, LongStackTrace ls) => print('EXCEPTION: $e\n$s\n$ls');
- // Type was ZoneOnError: dartbug 13519
-
- LongStackTrace _longStacktrace = null;
-
- LongStackTrace _getLongStacktrace(name) {
- var shortStacktrace = 'Long-stacktraces supressed in production.';
- assert((shortStacktrace = _getStacktrace()) != null);
- return new LongStackTrace(name, shortStacktrace, _longStacktrace);
- }
-
- _getStacktrace() {
- try {
- throw [];
- } catch (e, s) {
- return s;
- }
- }
-
- /**
- * Runs the provided function in the zone. Any runAsync calls (e.g. futures)
- * will also be run in this zone.
- *
- * Returns the return value of body.
- */
- run(body()) => _zone.run(body);
-
- /**
- * Allows one to escape the auto-digest mechanism of Angular.
- *
- * myFunction(NgZone zone, Element element) {
- * element.onClick.listen(() {
- * // auto-digest will run after element click.
- * });
- * zone.runOutsideAngular(() {
- * element.onMouseMove.listen(() {
- * // auto-digest will NOT run after mouse move
- * });
- * });
- * }
- */
- runOutsideAngular(body()) => _outerZone.run(body);
-
- assertInTurn() {
- assert(_runningInTurn > 0 || _inFinishTurn);
- }
-
- assertInZone() {
- assertInTurn();
- }
-}
« no previous file with comments | « third_party/pkg/angular/lib/core/service.dart ('k') | third_party/pkg/angular/lib/core_dom/block.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698