| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 class _ChunkedInputStream implements ChunkedInputStream { | 5 class _ChunkedInputStream implements ChunkedInputStream { |
| 6 _ChunkedInputStream(InputStream this._input, [int chunkSize]) | 6 _ChunkedInputStream(InputStream this._input, [int chunkSize]) |
| 7 : _chunkSize = chunkSize, _bufferList = new _BufferList() { | 7 : _chunkSize = chunkSize, _bufferList = new _BufferList() { |
| 8 if (_chunkSize === null) { | 8 if (_chunkSize === null) { |
| 9 _chunkSize = 0; | 9 _chunkSize = 0; |
| 10 } | 10 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 void _readData() { | 59 void _readData() { |
| 60 List<int> data = _input.read(); | 60 List<int> data = _input.read(); |
| 61 if (data !== null) { | 61 if (data !== null) { |
| 62 _bufferList.add(data); | 62 _bufferList.add(data); |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 void _closeHandler() { | 66 void _closeHandler() { |
| 67 _inputClosed = true; | 67 _inputClosed = true; |
| 68 if (_bufferList.length == 0 && _clientCloseHandler) { | 68 if (_bufferList.length == 0 && _clientCloseHandler !== null) { |
| 69 _clientCloseHandler(); | 69 _clientCloseHandler(); |
| 70 _closed = true; | 70 _closed = true; |
| 71 } else { | 71 } else { |
| 72 _checkScheduleCallback(); | 72 _checkScheduleCallback(); |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 void _checkInstallDataHandler() { | 76 void _checkInstallDataHandler() { |
| 77 if (_clientDataHandler === null) { | 77 if (_clientDataHandler === null) { |
| 78 _input.dataHandler = null; | 78 _input.dataHandler = null; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 InputStream _input; | 118 InputStream _input; |
| 119 _BufferList _bufferList; | 119 _BufferList _bufferList; |
| 120 int _chunkSize; | 120 int _chunkSize; |
| 121 bool _inputClosed = false; // Is the underlying input stream closed? | 121 bool _inputClosed = false; // Is the underlying input stream closed? |
| 122 bool _closed = false; // Has the close handler been called?. | 122 bool _closed = false; // Has the close handler been called?. |
| 123 var _clientDataHandler; | 123 var _clientDataHandler; |
| 124 var _clientCloseHandler; | 124 var _clientCloseHandler; |
| 125 } | 125 } |
| OLD | NEW |