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

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

Issue 48483002: Remove deprecated parts of dart:async. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 /** The onValue and onError handlers return either a value or a future */ 7 /** The onValue and onError handlers return either a value or a future */
8 typedef dynamic _FutureOnValue<T>(T value); 8 typedef dynamic _FutureOnValue<T>(T value);
9 /** Test used by [Future.catchError] to handle skip some errors. */ 9 /** Test used by [Future.catchError] to handle skip some errors. */
10 typedef bool _FutureErrorTest(var error); 10 typedef bool _FutureErrorTest(var error);
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 _propagateToListeners(this, listeners); 302 _propagateToListeners(this, listeners);
303 } 303 }
304 304
305 void _completeError(error, [StackTrace stackTrace]) { 305 void _completeError(error, [StackTrace stackTrace]) {
306 assert(!_isComplete); 306 assert(!_isComplete);
307 assert(_onValue == null); 307 assert(_onValue == null);
308 assert(_onError == null); 308 assert(_onError == null);
309 assert(_whenCompleteAction == null); 309 assert(_whenCompleteAction == null);
310 assert(_errorTest == null); 310 assert(_errorTest == null);
311 311
312 if (stackTrace != null) {
313 // Force the stack trace onto the error, even if it already had one.
314 _attachStackTrace(error, stackTrace);
315 }
316
317 _Future listeners = _isChained ? null : _removeListeners(); 312 _Future listeners = _isChained ? null : _removeListeners();
318 _setError(error, stackTrace); 313 _setError(error, stackTrace);
319 _propagateToListeners(this, listeners); 314 _propagateToListeners(this, listeners);
320 } 315 }
321 316
322 void _asyncComplete(value) { 317 void _asyncComplete(value) {
323 assert(!_isComplete); 318 assert(!_isComplete);
324 assert(_onValue == null); 319 assert(_onValue == null);
325 assert(_onError == null); 320 assert(_onError == null);
326 assert(_whenCompleteAction == null); 321 assert(_whenCompleteAction == null);
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 }); 495 });
501 isPropagationAborted = true; 496 isPropagationAborted = true;
502 } 497 }
503 } 498 }
504 } catch (e, s) { 499 } catch (e, s) {
505 // Set the exception as error unless the error is the same as the 500 // Set the exception as error unless the error is the same as the
506 // original one. 501 // original one.
507 if (hasError && identical(source._error.error, e)) { 502 if (hasError && identical(source._error.error, e)) {
508 listenerValueOrError = source._error; 503 listenerValueOrError = source._error;
509 } else { 504 } else {
510 listenerValueOrError = new _AsyncError(_asyncError(e, s), s); 505 listenerValueOrError = new _AsyncError(e, s);
511 } 506 }
512 listenerHasValue = false; 507 listenerHasValue = false;
513 } 508 }
514 }); 509 });
515 if (isPropagationAborted) return; 510 if (isPropagationAborted) return;
516 // If the listener's value is a future we need to chain it. 511 // If the listener's value is a future we need to chain it.
517 if (listenerHasValue && listenerValueOrError is Future) { 512 if (listenerHasValue && listenerValueOrError is Future) {
518 Future chainSource = listenerValueOrError; 513 Future chainSource = listenerValueOrError;
519 // Shortcut if the chain-source is already completed. Just continue the 514 // Shortcut if the chain-source is already completed. Just continue the
520 // loop. 515 // loop.
(...skipping 14 matching lines...) Expand all
535 } else { 530 } else {
536 listeners = listener._removeListeners(); 531 listeners = listener._removeListeners();
537 _AsyncError asyncError = listenerValueOrError; 532 _AsyncError asyncError = listenerValueOrError;
538 listener._setError(asyncError.error, asyncError.stackTrace); 533 listener._setError(asyncError.error, asyncError.stackTrace);
539 } 534 }
540 // Prepare for next round. 535 // Prepare for next round.
541 source = listener; 536 source = listener;
542 } 537 }
543 } 538 }
544 } 539 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698