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

Unified Diff: runtime/bin/list_stream.dart

Issue 9029001: Add close to input stream and cleanup socket and streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years 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 side-by-side diff with in-line comments
Download patch
Index: runtime/bin/list_stream.dart
diff --git a/runtime/bin/list_stream.dart b/runtime/bin/list_stream.dart
index da5826ec8e956bbec2039d07d62e81b6fb8fc7ad..dfb370a37133405e03287866845f2cdb7be61f2b 100644
--- a/runtime/bin/list_stream.dart
+++ b/runtime/bin/list_stream.dart
@@ -26,8 +26,13 @@ class ListInputStream extends _BaseDataInputStream implements InputStream {
return bytesToRead;
}
+ void _close() {
+ _offset = _buffer.length;
+ }
+
List<int> _buffer;
int _offset = 0;
+ bool _closeCalled = false;
Mads Ager (google) 2011/12/23 08:35:40 Is this ever used?
Søren Gjesse 2012/01/02 11:51:17 No, removed.
}
@@ -38,6 +43,9 @@ class DynamicListInputStream
int available() => _bufferList.length;
void write(List<int> data) {
+ if (_streamMarkedClosed || _closeCalled) {
Mads Ager (google) 2011/12/23 08:35:40 I think you can get rid of _closeCalled here as we
Søren Gjesse 2012/01/02 11:51:17 Done.
+ throw new StreamException.streamClosed();
+ }
_bufferList.add(data);
_checkScheduleCallbacks();
}
@@ -57,7 +65,13 @@ class DynamicListInputStream
return bytesToRead;
}
+ void _close() {
+ _streamMarkedClosed = true;
+ _bufferList.clear();
+ }
+
_BufferList _bufferList;
+ bool _closeCalled = false;
}

Powered by Google App Engine
This is Rietveld 408576698