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

Side by Side Diff: sdk/lib/io/http_parser.dart

Issue 14753009: Make StreamSubscription be the active part of a stream. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Made tests run (mostly) Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 // Global constants. 7 // Global constants.
8 class _Const { 8 class _Const {
9 // Bytes for "HTTP". 9 // Bytes for "HTTP".
10 static const HTTP = const [72, 84, 84, 80]; 10 static const HTTP = const [72, 84, 84, 80];
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
921 _incoming = null; 921 _incoming = null;
922 if (_bodyController != null) { 922 if (_bodyController != null) {
923 _bodyController.close(); 923 _bodyController.close();
924 _bodyController = null; 924 _bodyController = null;
925 } 925 }
926 _bodyPaused = false; 926 _bodyPaused = false;
927 _pauseStateChanged(); 927 _pauseStateChanged();
928 } 928 }
929 929
930 void _pauseStateChanged() { 930 void _pauseStateChanged() {
931 void update(bool pause) {
Anders Johnsen 2013/05/22 13:07:08 Ty!
932 if (pause && !_socketSubscription.isPaused) {
933 _socketSubscription.pause();
934 } else if (!pause && _socketSubscription.isPaused) {
935 _socketSubscription.resume();
936 }
937 }
938
939 if (_incoming != null) { 931 if (_incoming != null) {
940 if (!_bodyPaused && !_parserCalled) { 932 if (!_bodyPaused && !_parserCalled) {
941 _parse(); 933 _parse();
942 } 934 }
943 } else { 935 } else {
944 if (!_paused && !_parserCalled) { 936 if (!_paused && !_parserCalled) {
945 _parse(); 937 _parse();
946 } 938 }
947 } 939 }
948 } 940 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 StreamController<_HttpIncoming> _controller; 983 StreamController<_HttpIncoming> _controller;
992 StreamController<List<int>> _bodyController; 984 StreamController<List<int>> _bodyController;
993 } 985 }
994 986
995 987
996 class HttpParserException implements Exception { 988 class HttpParserException implements Exception {
997 const HttpParserException([String this.message = ""]); 989 const HttpParserException([String this.message = ""]);
998 String toString() => "HttpParserException: $message"; 990 String toString() => "HttpParserException: $message";
999 final String message; 991 final String message;
1000 } 992 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698