| 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 /** | 5 /** |
| 6 * Default implementation of [ListInputStream]. | 6 * Default implementation of [ListInputStream]. |
| 7 */ | 7 */ |
| 8 class _ListInputStream extends _BaseDataInputStream implements ListInputStream { | 8 class _ListInputStream extends _BaseDataInputStream implements ListInputStream { |
| 9 _ListInputStream() : _bufferList = new _BufferList(); | 9 _ListInputStream() : _bufferList = new _BufferList(); |
| 10 | 10 |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 _scheduledNoPendingWriteCallback = null; | 109 _scheduledNoPendingWriteCallback = null; |
| 110 if (_clientNoPendingWriteHandler != null && | 110 if (_clientNoPendingWriteHandler != null && |
| 111 !_streamMarkedClosed) { | 111 !_streamMarkedClosed) { |
| 112 _clientNoPendingWriteHandler(); | 112 _clientNoPendingWriteHandler(); |
| 113 _checkScheduleCallbacks(); | 113 _checkScheduleCallbacks(); |
| 114 } | 114 } |
| 115 } | 115 } |
| 116 | 116 |
| 117 void issueCloseCallback(Timer timer) { | 117 void issueCloseCallback(Timer timer) { |
| 118 _scheduledCloseCallback = null; | 118 _scheduledCloseCallback = null; |
| 119 if (_clientCloseHandler !== null) _clientCloseHandler(); | 119 if (_clientCloseHandler != null) _clientCloseHandler(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Schedule no pending callback if there is a callback set as this | 122 // Schedule no pending callback if there is a callback set as this |
| 123 // output stream does not wait for any transmission. Schedule | 123 // output stream does not wait for any transmission. Schedule |
| 124 // close callback once when the stream is closed. Only schedule a | 124 // close callback once when the stream is closed. Only schedule a |
| 125 // new callback if the previous one has actually been called. | 125 // new callback if the previous one has actually been called. |
| 126 if (_closeCallbackCalled) return; | 126 if (_closeCallbackCalled) return; |
| 127 | 127 |
| 128 if (!_streamMarkedClosed) { | 128 if (!_streamMarkedClosed) { |
| 129 if (!_bufferList.isEmpty && | 129 if (!_bufferList.isEmpty && |
| (...skipping 20 matching lines...) Expand all Loading... |
| 150 _BufferList _bufferList; | 150 _BufferList _bufferList; |
| 151 bool _streamMarkedClosed = false; | 151 bool _streamMarkedClosed = false; |
| 152 bool _closeCallbackCalled = false; | 152 bool _closeCallbackCalled = false; |
| 153 Timer _scheduledDataCallback; | 153 Timer _scheduledDataCallback; |
| 154 Timer _scheduledNoPendingWriteCallback; | 154 Timer _scheduledNoPendingWriteCallback; |
| 155 Timer _scheduledCloseCallback; | 155 Timer _scheduledCloseCallback; |
| 156 Function _clientDataHandler; | 156 Function _clientDataHandler; |
| 157 Function _clientNoPendingWriteHandler; | 157 Function _clientNoPendingWriteHandler; |
| 158 Function _clientCloseHandler; | 158 Function _clientCloseHandler; |
| 159 } | 159 } |
| OLD | NEW |