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

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

Issue 14070010: Refactor Future constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 /** 7 /**
8 * A high-level class for communicating securely over a TCP socket, using 8 * A high-level class for communicating securely over a TCP socket, using
9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an 9 * TLS and SSL. The [SecureSocket] exposes both a [Stream] and an
10 * [IOSink] interface, making it ideal for using together with 10 * [IOSink] interface, making it ideal for using together with
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 _secureFilter.init(); 254 _secureFilter.init();
255 _secureFilter.registerHandshakeCompleteCallback( 255 _secureFilter.registerHandshakeCompleteCallback(
256 _secureHandshakeCompleteHandler); 256 _secureHandshakeCompleteHandler);
257 if (onBadCertificate != null) { 257 if (onBadCertificate != null) {
258 _secureFilter.registerBadCertificateCallback(onBadCertificate); 258 _secureFilter.registerBadCertificateCallback(onBadCertificate);
259 } 259 }
260 var futureSocket; 260 var futureSocket;
261 if (socket == null) { 261 if (socket == null) {
262 futureSocket = RawSocket.connect(host, requestedPort); 262 futureSocket = RawSocket.connect(host, requestedPort);
263 } else { 263 } else {
264 futureSocket = new Future.immediate(socket); 264 futureSocket = new Future.value(socket);
265 } 265 }
266 futureSocket.then((rawSocket) { 266 futureSocket.then((rawSocket) {
267 rawSocket.writeEventsEnabled = false; 267 rawSocket.writeEventsEnabled = false;
268 _socket = rawSocket; 268 _socket = rawSocket;
269 _socketSubscription = _socket.listen(_eventDispatcher, 269 _socketSubscription = _socket.listen(_eventDispatcher,
270 onError: _errorHandler, 270 onError: _errorHandler,
271 onDone: _doneHandler); 271 onDone: _doneHandler);
272 _connectPending = true; 272 _connectPending = true;
273 _secureFilter.connect(host, 273 _secureFilter.connect(host,
274 port, 274 port,
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 void destroy(); 753 void destroy();
754 void handshake(); 754 void handshake();
755 void init(); 755 void init();
756 X509Certificate get peerCertificate; 756 X509Certificate get peerCertificate;
757 int processBuffer(int bufferIndex); 757 int processBuffer(int bufferIndex);
758 void registerBadCertificateCallback(Function callback); 758 void registerBadCertificateCallback(Function callback);
759 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler); 759 void registerHandshakeCompleteCallback(Function handshakeCompleteHandler);
760 760
761 List<_ExternalBuffer> get buffers; 761 List<_ExternalBuffer> get buffers;
762 } 762 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698