Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: runtime/bin/chunked_stream.dart

Issue 9129020: Another round of minor fixes in the IO libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/bin/directory_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 30 matching lines...) Expand all
41 41
42 void set dataHandler(void callback()) { 42 void set dataHandler(void callback()) {
43 _clientDataHandler = callback; 43 _clientDataHandler = callback;
44 _checkInstallDataHandler(); 44 _checkInstallDataHandler();
45 } 45 }
46 46
47 void set closeHandler(void callback()) { 47 void set closeHandler(void callback()) {
48 _clientCloseHandler = callback; 48 _clientCloseHandler = callback;
49 } 49 }
50 50
51 void set errorHandler(void callback()) {
52 _input.errorHandler = callback;
53 }
54
51 void _dataHandler() { 55 void _dataHandler() {
52 _readData(); 56 _readData();
53 if (_bufferList.length >= _chunkSize && _clientDataHandler !== null) { 57 if (_bufferList.length >= _chunkSize && _clientDataHandler !== null) {
54 _clientDataHandler(); 58 _clientDataHandler();
55 } 59 }
56 _checkScheduleCallback(); 60 _checkScheduleCallback();
57 _checkInstallDataHandler(); 61 _checkInstallDataHandler();
58 } 62 }
59 63
60 void _readData() { 64 void _readData() {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 InputStream _input; 129 InputStream _input;
126 _BufferList _bufferList; 130 _BufferList _bufferList;
127 int _chunkSize; 131 int _chunkSize;
128 bool _inputClosed = false; // Is the underlying input stream closed? 132 bool _inputClosed = false; // Is the underlying input stream closed?
129 bool _closed = false; // Has the close handler been called?. 133 bool _closed = false; // Has the close handler been called?.
130 Timer _scheduledDataCallback; 134 Timer _scheduledDataCallback;
131 Timer _scheduledCloseCallback; 135 Timer _scheduledCloseCallback;
132 Function _clientDataHandler; 136 Function _clientDataHandler;
133 Function _clientCloseHandler; 137 Function _clientCloseHandler;
134 } 138 }
OLDNEW
« no previous file with comments | « no previous file | runtime/bin/directory_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698