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

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 11280162: Add onError to dart:io SecureSocket. Allow onConnect and outputStream to coexist on Socket and Sec… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix typo. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | sdk/lib/io/secure_socket.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 ServerSocket { 5 patch class ServerSocket {
6 /* patch */ factory ServerSocket(String bindAddress, int port, int backlog) { 6 /* patch */ factory ServerSocket(String bindAddress, int port, int backlog) {
7 return new _ServerSocket(bindAddress, port, backlog); 7 return new _ServerSocket(bindAddress, port, backlog);
8 } 8 }
9 } 9 }
10 10
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 "Cannot set write handler when output stream is used"); 462 "Cannot set write handler when output stream is used");
463 _clientWriteHandler = callback; 463 _clientWriteHandler = callback;
464 _updateOutHandler(); 464 _updateOutHandler();
465 } 465 }
466 466
467 void set onConnect(void callback()) { 467 void set onConnect(void callback()) {
468 if (_seenFirstOutEvent) { 468 if (_seenFirstOutEvent) {
469 throw new StreamException( 469 throw new StreamException(
470 "Cannot set connect handler when already connected"); 470 "Cannot set connect handler when already connected");
471 } 471 }
472 if (_outputStream != null) {
473 throw new StreamException(
474 "Cannot set connect handler when output stream is used");
475 }
476 _clientConnectHandler = callback; 472 _clientConnectHandler = callback;
477 _updateOutHandler(); 473 _updateOutHandler();
478 } 474 }
479 475
480 void set onData(void callback()) { 476 void set onData(void callback()) {
481 if (_inputStream != null) throw new StreamException( 477 if (_inputStream != null) throw new StreamException(
482 "Cannot set data handler when input stream is used"); 478 "Cannot set data handler when input stream is used");
483 _onData = callback; 479 _onData = callback;
484 } 480 }
485 481
(...skipping 14 matching lines...) Expand all
500 throw new StreamException( 496 throw new StreamException(
501 "Cannot get input stream when socket handlers are used"); 497 "Cannot get input stream when socket handlers are used");
502 } 498 }
503 _inputStream = new _SocketInputStream(this); 499 _inputStream = new _SocketInputStream(this);
504 } 500 }
505 return _inputStream; 501 return _inputStream;
506 } 502 }
507 503
508 OutputStream get outputStream { 504 OutputStream get outputStream {
509 if (_outputStream == null) { 505 if (_outputStream == null) {
510 if (_handlerMap[_SocketBase._OUT_EVENT] != null) { 506 if (_clientWriteHandler != null) {
511 throw new StreamException( 507 throw new StreamException(
512 "Cannot get output stream when socket handlers are used"); 508 "Cannot get output stream when socket handlers are used");
513 } 509 }
514 _outputStream = new _SocketOutputStream(this); 510 _outputStream = new _SocketOutputStream(this);
515 } 511 }
516 return _outputStream; 512 return _outputStream;
517 } 513 }
518 514
519 void set _onWrite(void callback()) { 515 void set _onWrite(void callback()) {
520 _setHandler(_SocketBase._OUT_EVENT, callback); 516 _setHandler(_SocketBase._OUT_EVENT, callback);
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 bool _seenFirstOutEvent = false; 594 bool _seenFirstOutEvent = false;
599 bool _pipe = false; 595 bool _pipe = false;
600 Function _clientConnectHandler; 596 Function _clientConnectHandler;
601 Function _clientWriteHandler; 597 Function _clientWriteHandler;
602 _SocketInputStream _inputStream; 598 _SocketInputStream _inputStream;
603 _SocketOutputStream _outputStream; 599 _SocketOutputStream _outputStream;
604 String _remoteHost; 600 String _remoteHost;
605 int _remotePort; 601 int _remotePort;
606 static SendPort _socketService; 602 static SendPort _socketService;
607 } 603 }
OLDNEW
« no previous file with comments | « runtime/bin/secure_socket.cc ('k') | sdk/lib/io/secure_socket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698