| 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); | 10 void _addError(Object error); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 * Set by calling [cancel], or by handling a "done" event, or an "error" event | 70 * Set by calling [cancel], or by handling a "done" event, or an "error" event |
| 71 * when `cancelOnError` is true. | 71 * when `cancelOnError` is true. |
| 72 */ | 72 */ |
| 73 static const int _STATE_CANCELED = 8; | 73 static const int _STATE_CANCELED = 8; |
| 74 static const int _STATE_IN_CALLBACK = 16; | 74 static const int _STATE_IN_CALLBACK = 16; |
| 75 static const int _STATE_HAS_PENDING = 32; | 75 static const int _STATE_HAS_PENDING = 32; |
| 76 static const int _STATE_PAUSE_COUNT = 64; | 76 static const int _STATE_PAUSE_COUNT = 64; |
| 77 static const int _STATE_PAUSE_COUNT_SHIFT = 6; | 77 static const int _STATE_PAUSE_COUNT_SHIFT = 6; |
| 78 | 78 |
| 79 /* Event handlers provided in constructor. */ | 79 /* Event handlers provided in constructor. */ |
| 80 /* TODO(7733): Fix Function->_DataHandler<T> when dart2js understands | 80 _DataHandler<T> _onData; |
| 81 * parameterized function types. */ | |
| 82 Function _onData; | |
| 83 _ErrorHandler _onError; | 81 _ErrorHandler _onError; |
| 84 _DoneHandler _onDone; | 82 _DoneHandler _onDone; |
| 85 final _Zone _zone = _Zone.current; | 83 final _Zone _zone = _Zone.current; |
| 86 | 84 |
| 87 /** Bit vector based on state-constants above. */ | 85 /** Bit vector based on state-constants above. */ |
| 88 int _state; | 86 int _state; |
| 89 | 87 |
| 90 /** | 88 /** |
| 91 * Queue of pending events. | 89 * Queue of pending events. |
| 92 * | 90 * |
| (...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 _FutureImpl<bool> hasNext = _futureOrPrefetch; | 997 _FutureImpl<bool> hasNext = _futureOrPrefetch; |
| 1000 _clear(); | 998 _clear(); |
| 1001 hasNext._setValue(false); | 999 hasNext._setValue(false); |
| 1002 return; | 1000 return; |
| 1003 } | 1001 } |
| 1004 _subscription.pause(); | 1002 _subscription.pause(); |
| 1005 _futureOrPrefetch = null; | 1003 _futureOrPrefetch = null; |
| 1006 _state = _STATE_EXTRA_DONE; | 1004 _state = _STATE_EXTRA_DONE; |
| 1007 } | 1005 } |
| 1008 } | 1006 } |
| OLD | NEW |