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

Side by Side Diff: runtime/bin/socket_patch.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 | « pkg/scheduled_test/lib/src/mock_clock.dart ('k') | sdk/lib/async/stream.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 patch class RawServerSocket { 5 patch class RawServerSocket {
6 /* patch */ static Future<RawServerSocket> bind([String address = "127.0.0.1", 6 /* patch */ static Future<RawServerSocket> bind([String address = "127.0.0.1",
7 int port = 0, 7 int port = 0,
8 int backlog = 0]) { 8 int backlog = 0]) {
9 return _RawServerSocket.bind(address, port, backlog); 9 return _RawServerSocket.bind(address, port, backlog);
10 } 10 }
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 464
465 void _pause() { 465 void _pause() {
466 _socket.setListening(read: false, write: false); 466 _socket.setListening(read: false, write: false);
467 } 467 }
468 468
469 void _resume() { 469 void _resume() {
470 _socket.setListening(read: true, write: false); 470 _socket.setListening(read: true, write: false);
471 } 471 }
472 472
473 void _onSubscriptionStateChange() { 473 void _onSubscriptionStateChange() {
474 if (_controller.hasSubscribers) { 474 if (_controller.hasListener) {
475 _resume(); 475 _resume();
476 } else { 476 } else {
477 close(); 477 close();
478 } 478 }
479 } 479 }
480 void _onPauseStateChange() { 480 void _onPauseStateChange() {
481 if (_controller.isPaused) { 481 if (_controller.isPaused) {
482 _pause(); 482 _pause();
483 } else { 483 } else {
484 _resume(); 484 _resume();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 591
592 void _onPauseStateChange() { 592 void _onPauseStateChange() {
593 if (_controller.isPaused) { 593 if (_controller.isPaused) {
594 _pause(); 594 _pause();
595 } else { 595 } else {
596 _resume(); 596 _resume();
597 } 597 }
598 } 598 }
599 599
600 void _onSubscriptionStateChange() { 600 void _onSubscriptionStateChange() {
601 if (_controller.hasSubscribers) { 601 if (_controller.hasListener) {
602 _resume(); 602 _resume();
603 } else { 603 } else {
604 close(); 604 close();
605 } 605 }
606 } 606 }
607 } 607 }
608 608
609 609
610 patch class ServerSocket { 610 patch class ServerSocket {
611 /* patch */ static Future<ServerSocket> bind([String address = "127.0.0.1", 611 /* patch */ static Future<ServerSocket> bind([String address = "127.0.0.1",
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 } 860 }
861 861
862 _closeRawSocket() { 862 _closeRawSocket() {
863 var tmp = _raw; 863 var tmp = _raw;
864 _raw = null; 864 _raw = null;
865 _closed = true; 865 _closed = true;
866 tmp.close(); 866 tmp.close();
867 } 867 }
868 868
869 void _onSubscriptionStateChange() { 869 void _onSubscriptionStateChange() {
870 if (_controller.hasSubscribers) { 870 if (_controller.hasListener) {
871 _ensureRawSocketSubscription(); 871 _ensureRawSocketSubscription();
872 // Enable read events for providing data to subscription. 872 // Enable read events for providing data to subscription.
873 if (_raw != null) { 873 if (_raw != null) {
874 _raw.readEventsEnabled = true; 874 _raw.readEventsEnabled = true;
875 } 875 }
876 } else { 876 } else {
877 _controllerClosed = true; 877 _controllerClosed = true;
878 if (_raw != null) { 878 if (_raw != null) {
879 _raw.shutdown(SocketDirection.RECEIVE); 879 _raw.shutdown(SocketDirection.RECEIVE);
880 } 880 }
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 _raw.onBadCertificate = callback; 973 _raw.onBadCertificate = callback;
974 } 974 }
975 975
976 X509Certificate get peerCertificate { 976 X509Certificate get peerCertificate {
977 if (_raw == null) { 977 if (_raw == null) {
978 throw new StateError("peerCertificate called on destroyed SecureSocket"); 978 throw new StateError("peerCertificate called on destroyed SecureSocket");
979 } 979 }
980 return _raw.peerCertificate; 980 return _raw.peerCertificate;
981 } 981 }
982 } 982 }
OLDNEW
« no previous file with comments | « pkg/scheduled_test/lib/src/mock_clock.dart ('k') | sdk/lib/async/stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698