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

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

Issue 14103010: Change hasSubscribers to hasListener. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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 | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/io_sink.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) 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 void onPauseStateChange() { 160 void onPauseStateChange() {
161 if (controller.isPaused) { 161 if (controller.isPaused) {
162 pause(); 162 pause();
163 } else { 163 } else {
164 resume(); 164 resume();
165 } 165 }
166 } 166 }
167 167
168 void onSubscriptionStateChange() { 168 void onSubscriptionStateChange() {
169 if (controller.hasSubscribers) { 169 if (controller.hasListener) {
170 resume(); 170 resume();
171 } else { 171 } else {
172 subscription.cancel(); 172 subscription.cancel();
173 } 173 }
174 } 174 }
175 } 175 }
176 176
177 177
178 /** 178 /**
179 * HTTP parser which parses the data stream given to [consume]. 179 * HTTP parser which parses the data stream given to [consume].
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 void _continueParsing() { 905 void _continueParsing() {
906 _paused = false; 906 _paused = false;
907 if (!_parserCalled && _buffer != null) _parse(); 907 if (!_parserCalled && _buffer != null) _parse();
908 } 908 }
909 909
910 void _pauseParsing() { 910 void _pauseParsing() {
911 _paused = true; 911 _paused = true;
912 } 912 }
913 913
914 void _bodySubscriptionStateChange() { 914 void _bodySubscriptionStateChange() {
915 if (_incoming != null && !_bodyController.hasSubscribers) { 915 if (_incoming != null && !_bodyController.hasListener) {
916 _closeIncoming(); 916 _closeIncoming();
917 } else { 917 } else {
918 _updateParsePauseState(); 918 _updateParsePauseState();
919 } 919 }
920 } 920 }
921 921
922 void _updateParsePauseState() { 922 void _updateParsePauseState() {
923 if (_bodyController != null) { 923 if (_bodyController != null) {
924 if (_bodyController.hasSubscribers && !_bodyController.isPaused) { 924 if (_bodyController.hasListener && !_bodyController.isPaused) {
925 _continueParsing(); 925 _continueParsing();
926 } else { 926 } else {
927 _pauseParsing(); 927 _pauseParsing();
928 } 928 }
929 } else { 929 } else {
930 if (_controller.hasSubscribers && !_controller.isPaused) { 930 if (_controller.hasListener && !_controller.isPaused) {
931 _continueParsing(); 931 _continueParsing();
932 } else { 932 } else {
933 _pauseParsing(); 933 _pauseParsing();
934 } 934 }
935 } 935 }
936 } 936 }
937 937
938 void error(error) { 938 void error(error) {
939 if (_socketSubscription != null) _socketSubscription.cancel(); 939 if (_socketSubscription != null) _socketSubscription.cancel();
940 _state = _State.FAILURE; 940 _state = _State.FAILURE;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 StreamController<_HttpIncoming> _controller; 979 StreamController<_HttpIncoming> _controller;
980 StreamController<List<int>> _bodyController; 980 StreamController<List<int>> _bodyController;
981 } 981 }
982 982
983 983
984 class HttpParserException implements Exception { 984 class HttpParserException implements Exception {
985 const HttpParserException([String this.message = ""]); 985 const HttpParserException([String this.message = ""]);
986 String toString() => "HttpParserException: $message"; 986 String toString() => "HttpParserException: $message";
987 final String message; 987 final String message;
988 } 988 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file_impl.dart ('k') | sdk/lib/io/io_sink.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698