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

Unified Diff: sdk/lib/io/http_parser.dart

Issue 171403003: Clean up usage of streams in http-parser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/http_parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/http_parser.dart
diff --git a/sdk/lib/io/http_parser.dart b/sdk/lib/io/http_parser.dart
index 0506a0503f61d021699b206394728e926be56f97..34aaee9685ae3feb06da98868b3316ea46528f85 100644
--- a/sdk/lib/io/http_parser.dart
+++ b/sdk/lib/io/http_parser.dart
@@ -234,9 +234,7 @@ class _HttpDetachedIncoming extends Stream<List<int>> {
* and should be handled according to whatever protocol is being
* upgraded to.
*/
-class _HttpParser
- extends Stream<_HttpIncoming>
- implements StreamConsumer<List<int>> {
+class _HttpParser extends Stream<_HttpIncoming> {
// State.
bool _parserCalled = false;
@@ -315,25 +313,16 @@ class _HttpParser
cancelOnError: cancelOnError);
}
- Future<_HttpParser> addStream(Stream<List<int>> stream) {
+ void listenToStream(Stream<List<int>> stream) {
// Listen to the stream and handle data accordingly. When a
// _HttpIncoming is created, _dataPause, _dataResume, _dataDone is
// given to provide a way of controlling the parser.
// TODO(ajohnsen): Remove _dataPause, _dataResume and _dataDone and clean up
// how the _HttpIncoming signals the parser.
- var completer = new Completer();
_socketSubscription = stream.listen(
_onData,
onError: _onError,
- onDone: () {
- completer.complete(this);
- });
- return completer.future;
- }
-
- Future<_HttpParser> close() {
- _onDone();
- return new Future.value(this);
+ onDone: _onDone);
}
void _parse() {
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | tests/standalone/io/http_parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698