Chromium Code Reviews| Index: extensions/browser/api/socket/tls_socket.cc |
| diff --git a/extensions/browser/api/socket/tls_socket.cc b/extensions/browser/api/socket/tls_socket.cc |
| index 5e1008d63afdac3cf565e413f1c3ff765c8a3ceb..79b020bf152dfb43e88807d3752f6e1925cb8ebe 100644 |
| --- a/extensions/browser/api/socket/tls_socket.cc |
| +++ b/extensions/browser/api/socket/tls_socket.cc |
| @@ -17,6 +17,8 @@ |
| #include "net/socket/tcp_client_socket.h" |
| #include "url/url_canon.h" |
| +using extensions::BufferingStreamSocket; |
| + |
| namespace { |
| // Returns the SSL protocol version (as a uint16) represented by a string. |
| @@ -46,13 +48,16 @@ void TlsConnectDone(scoped_ptr<net::SSLClientSocket> ssl_socket, |
| if (result != net::OK) { |
| callback.Run(scoped_ptr<extensions::TLSSocket>(), result); |
| return; |
| - }; |
| + } |
| + // Wrap the StreamSocket in a BufferingTCPSocket, to support SetPaused(). |
|
Ken Rockot(use gerrit already)
2015/12/15 17:17:49
nit: s/BufferingTCPSocket/BufferingStreamSocket/
|
| + scoped_ptr<BufferingStreamSocket> buffer_sock( |
|
Ken Rockot(use gerrit already)
2015/12/15 17:17:49
nit: buffer_socket? No real value in abbreviating
|
| + new BufferingStreamSocket(ssl_socket.Pass())); |
| // Wrap the StreamSocket in a TLSSocket, which matches the extension socket |
| // API. Set the handle of the socket to the new value, so that it can be |
| // used for read/write/close/etc. |
| scoped_ptr<extensions::TLSSocket> wrapper( |
| - new extensions::TLSSocket(ssl_socket.Pass(), extension_id)); |
| + new extensions::TLSSocket(buffer_sock.Pass(), extension_id)); |
| // Caller will end up deleting the prior TCPSocket, once it calls |
| // SetSocket(..,wrapper). |
| @@ -66,10 +71,9 @@ namespace extensions { |
| const char kTLSSocketTypeInvalidError[] = |
| "Cannot listen on a socket that is already connected."; |
| -TLSSocket::TLSSocket(scoped_ptr<net::StreamSocket> tls_socket, |
| +TLSSocket::TLSSocket(scoped_ptr<BufferingStreamSocket> tls_socket, |
| const std::string& owner_extension_id) |
| - : ResumableTCPSocket(owner_extension_id), tls_socket_(tls_socket.Pass()) { |
| -} |
| + : ResumableTCPSocket(owner_extension_id), tls_socket_(tls_socket.Pass()) {} |
| TLSSocket::~TLSSocket() { |
| Disconnect(); |
| @@ -230,6 +234,7 @@ void TLSSocket::UpgradeSocketToTLS( |
| // Set the socket handle to the socket's client stream (that should be the |
| // only one active here). Then have the old socket release ownership on |
| // that client stream. |
| + tcp_socket->ClientStream()->DisableBuffering(); |
| socket_handle->SetSocket( |
| scoped_ptr<net::StreamSocket>(tcp_socket->ClientStream())); |
| tcp_socket->Release(); |
| @@ -302,4 +307,3 @@ void TLSSocket::UpgradeSocketToTLS( |
| } |
| } // namespace extensions |
| - |