| OLD | NEW |
| 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 /** Abstract and private interface for a place to put events. */ | 7 /** Abstract and private interface for a place to put events. */ |
| 8 abstract class _EventSink<T> { | 8 abstract class _EventSink<T> { |
| 9 void _add(T data); | 9 void _add(T data); |
| 10 void _addError(Object error, StackTrace stackTrace); | 10 void _addError(Object error, StackTrace stackTrace); |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 assert(!_isCanceled); | 347 assert(!_isCanceled); |
| 348 assert(!_isPaused); | 348 assert(!_isPaused); |
| 349 assert(!_inCallback); | 349 assert(!_inCallback); |
| 350 bool wasInputPaused = _isInputPaused; | 350 bool wasInputPaused = _isInputPaused; |
| 351 | 351 |
| 352 void sendError() { | 352 void sendError() { |
| 353 // If the subscription has been canceled while waiting for the cancel | 353 // If the subscription has been canceled while waiting for the cancel |
| 354 // future to finish we must not report the error. | 354 // future to finish we must not report the error. |
| 355 if (_isCanceled && !_waitsForCancel) return; | 355 if (_isCanceled && !_waitsForCancel) return; |
| 356 _state |= _STATE_IN_CALLBACK; | 356 _state |= _STATE_IN_CALLBACK; |
| 357 if (!_zone.inSameErrorZone(Zone.current)) { | 357 if (_onError is ZoneBinaryCallback) { |
| 358 // Errors are not allowed to traverse zone boundaries. | |
| 359 Zone.current.handleUncaughtError(error, stackTrace); | |
| 360 } else if (_onError is ZoneBinaryCallback) { | |
| 361 _zone.runBinaryGuarded(_onError, error, stackTrace); | 358 _zone.runBinaryGuarded(_onError, error, stackTrace); |
| 362 } else { | 359 } else { |
| 363 _zone.runUnaryGuarded(_onError, error); | 360 _zone.runUnaryGuarded(_onError, error); |
| 364 } | 361 } |
| 365 _state &= ~_STATE_IN_CALLBACK; | 362 _state &= ~_STATE_IN_CALLBACK; |
| 366 } | 363 } |
| 367 | 364 |
| 368 if (_cancelOnError) { | 365 if (_cancelOnError) { |
| 369 _state |= _STATE_WAIT_FOR_CANCEL; | 366 _state |= _STATE_WAIT_FOR_CANCEL; |
| 370 _cancel(); | 367 _cancel(); |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1075 _Future<bool> hasNext = _futureOrPrefetch; | 1072 _Future<bool> hasNext = _futureOrPrefetch; |
| 1076 _clear(); | 1073 _clear(); |
| 1077 hasNext._complete(false); | 1074 hasNext._complete(false); |
| 1078 return; | 1075 return; |
| 1079 } | 1076 } |
| 1080 _subscription.pause(); | 1077 _subscription.pause(); |
| 1081 _futureOrPrefetch = null; | 1078 _futureOrPrefetch = null; |
| 1082 _state = _STATE_EXTRA_DONE; | 1079 _state = _STATE_EXTRA_DONE; |
| 1083 } | 1080 } |
| 1084 } | 1081 } |
| OLD | NEW |