| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 && |
| 130 _clientDataHandler != null && | 130 _clientDataHandler != null && |
| 131 _scheduledDataCallback == null) { | 131 _scheduledDataCallback == null) { |
| 132 _scheduledDataCallback = new Timer(0, issueDataCallback); | 132 _scheduledDataCallback = new Timer(0, issueDataCallback); |
| 133 } | 133 } |
| 134 | 134 |
| 135 if (_clientNoPendingWriteHandler != null && | 135 if (_clientNoPendingWriteHandler != null && |
| 136 _scheduledNoPendingWriteCallback == null && | 136 _scheduledNoPendingWriteCallback == null && |
| 137 _scheduledDataCallback == null) { | 137 _scheduledDataCallback == null) { |
| 138 _scheduledNoPendingWriteCallback = | 138 _scheduledNoPendingWriteCallback = |
| 139 new Timer(0, issueNoPendingWriteCallback); | 139 new Timer(0, issueNoPendingWriteCallback); |
| (...skipping 10 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 |