diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 00:08:10 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-05 00:08:10 +0000 |
commit | 3268023f1382463baf9ac9537664b90ab4ae6883 (patch) | |
tree | 286c919264367f10ff289f0828ba2a713eaf523e | |
parent | 44da8217868a044e283062254c0bf02f0c66f0a1 (diff) | |
download | chromium_src-3268023f1382463baf9ac9537664b90ab4ae6883.zip chromium_src-3268023f1382463baf9ac9537664b90ab4ae6883.tar.gz chromium_src-3268023f1382463baf9ac9537664b90ab4ae6883.tar.bz2 |
Rename ClientSocket to StreamSocket.
BUG=80895
TEST=Compiles
Review URL: http://codereview.chromium.org/6930014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@84167 0039d316-1c4b-4281-b951-d872f2087c98
79 files changed, 229 insertions, 229 deletions
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc index 349e476..1e5d48b 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc @@ -38,7 +38,7 @@ P2PSocketHostTcp::~P2PSocketHostTcp() { } bool P2PSocketHostTcp::InitAccepted(const net::IPEndPoint& remote_address, - net::ClientSocket* socket) { + net::StreamSocket* socket) { DCHECK(socket); DCHECK_EQ(state_, STATE_UNINITIALIZED); diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.h b/content/browser/renderer_host/p2p/socket_host_tcp.h index 01a9861..bb003c8 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp.h +++ b/content/browser/renderer_host/p2p/socket_host_tcp.h @@ -15,9 +15,9 @@ #include "net/base/ip_endpoint.h" namespace net { -class ClientSocket; class DrainableIOBuffer; class GrowableIOBuffer; +class StreamSocket; } // namespace net class P2PSocketHostTcp : public P2PSocketHost { @@ -27,7 +27,7 @@ class P2PSocketHostTcp : public P2PSocketHost { virtual ~P2PSocketHostTcp(); bool InitAccepted(const net::IPEndPoint& remote_address, - net::ClientSocket* socket); + net::StreamSocket* socket); // P2PSocketHost overrides. virtual bool Init(const net::IPEndPoint& local_address, @@ -56,7 +56,7 @@ class P2PSocketHostTcp : public P2PSocketHost { net::IPEndPoint remote_address_; - scoped_ptr<net::ClientSocket> socket_; + scoped_ptr<net::StreamSocket> socket_; scoped_refptr<net::GrowableIOBuffer> read_buffer_; scoped_refptr<net::DrainableIOBuffer> write_buffer_; diff --git a/content/browser/renderer_host/p2p/socket_host_tcp_server.cc b/content/browser/renderer_host/p2p/socket_host_tcp_server.cc index ae5ed2b..5578c79 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp_server.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp_server.cc @@ -11,7 +11,7 @@ #include "net/base/net_errors.h" #include "net/base/net_util.h" #include "net/base/sys_addrinfo.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace { const int kListenBacklog = 5; @@ -126,7 +126,7 @@ P2PSocketHost* P2PSocketHostTcpServer::AcceptIncomingTcpConnection( if (it == accepted_sockets_.end()) return NULL; - net::ClientSocket* socket = it->second; + net::StreamSocket* socket = it->second; accepted_sockets_.erase(it); scoped_ptr<P2PSocketHostTcp> result( new P2PSocketHostTcp(message_sender_, routing_id_, id)); diff --git a/content/browser/renderer_host/p2p/socket_host_tcp_server.h b/content/browser/renderer_host/p2p/socket_host_tcp_server.h index 7bafa76..6b4a83a 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp_server.h +++ b/content/browser/renderer_host/p2p/socket_host_tcp_server.h @@ -15,7 +15,7 @@ #include "net/socket/tcp_server_socket.h" namespace net { -class ClientSocket; +class StreamSocket; } // namespace net class P2PSocketHostTcpServer : public P2PSocketHost { @@ -35,7 +35,7 @@ class P2PSocketHostTcpServer : public P2PSocketHost { private: friend class P2PSocketHostTcpServerTest; - typedef std::map<net::IPEndPoint, net::ClientSocket*> AcceptedSocketsMap; + typedef std::map<net::IPEndPoint, net::StreamSocket*> AcceptedSocketsMap; void OnError(); @@ -48,7 +48,7 @@ class P2PSocketHostTcpServer : public P2PSocketHost { scoped_ptr<net::ServerSocket> socket_; net::IPEndPoint local_address_; - scoped_ptr<net::ClientSocket> accept_socket_; + scoped_ptr<net::StreamSocket> accept_socket_; AcceptedSocketsMap accepted_sockets_; net::CompletionCallbackImpl<P2PSocketHostTcpServer> accept_callback_; diff --git a/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc b/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc index e8eb51a..c3ef05e 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp_server_unittest.cc @@ -28,7 +28,7 @@ class FakeServerSocket : public net::ServerSocket { bool listening() { return listening_; } - void AddIncoming(net::ClientSocket* socket) { + void AddIncoming(net::StreamSocket* socket) { if (accept_callback_) { DCHECK(incoming_sockets_.empty()); accept_socket_->reset(socket); @@ -53,7 +53,7 @@ class FakeServerSocket : public net::ServerSocket { return net::OK; } - virtual int Accept(scoped_ptr<net::ClientSocket>* socket, + virtual int Accept(scoped_ptr<net::StreamSocket>* socket, net::CompletionCallback* callback) OVERRIDE { DCHECK(socket); if (!incoming_sockets_.empty()) { @@ -72,10 +72,10 @@ class FakeServerSocket : public net::ServerSocket { net::IPEndPoint local_address_; - scoped_ptr<net::ClientSocket>* accept_socket_; + scoped_ptr<net::StreamSocket>* accept_socket_; net::CompletionCallback* accept_callback_; - std::list<net::ClientSocket*> incoming_sockets_; + std::list<net::StreamSocket*> incoming_sockets_; }; } // namespace @@ -98,7 +98,7 @@ class P2PSocketHostTcpServerTest : public testing::Test { // Needed by the chilt classes because only this class is a friend // of P2PSocketHostTcp. - net::ClientSocket* GetSocketFormTcpSocketHost(P2PSocketHostTcp* host) { + net::StreamSocket* GetSocketFormTcpSocketHost(P2PSocketHostTcp* host) { return host->socket_.get(); } diff --git a/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc b/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc index af118f1..ea85741 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc @@ -8,7 +8,7 @@ #include "content/browser/renderer_host/p2p/socket_host_test_utils.h" #include "net/base/sys_byteorder.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/content/browser/renderer_host/p2p/socket_host_test_utils.h b/content/browser/renderer_host/p2p/socket_host_test_utils.h index 76e61ba..2c8eb22 100644 --- a/content/browser/renderer_host/p2p/socket_host_test_utils.h +++ b/content/browser/renderer_host/p2p/socket_host_test_utils.h @@ -15,7 +15,7 @@ #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/sys_byteorder.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -44,7 +44,7 @@ class MockIPCSender : public IPC::Message::Sender { MockIPCSender::MockIPCSender() { } MockIPCSender::~MockIPCSender() { } -class FakeSocket : public net::ClientSocket { +class FakeSocket : public net::StreamSocket { public: FakeSocket(std::string* written_data); virtual ~FakeSocket(); diff --git a/jingle/glue/pseudotcp_adapter.h b/jingle/glue/pseudotcp_adapter.h index 0001991..35df8ce 100644 --- a/jingle/glue/pseudotcp_adapter.h +++ b/jingle/glue/pseudotcp_adapter.h @@ -12,12 +12,12 @@ #include "base/timer.h" #include "base/threading/non_thread_safe.h" #include "net/base/net_log.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" #include "third_party/libjingle/source/talk/p2p/base/pseudotcp.h" namespace jingle_glue { -class PseudoTcpAdapter : public net::ClientSocket, +class PseudoTcpAdapter : public net::StreamSocket, public cricket::IPseudoTcpNotify, public base::NonThreadSafe { public: @@ -34,7 +34,7 @@ class PseudoTcpAdapter : public net::ClientSocket, virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; virtual bool SetSendBufferSize(int32 size) OVERRIDE; - // net::ClientSocket implementation. + // net::StreamSocket implementation. virtual int Connect(net::CompletionCallback* callback) OVERRIDE; virtual void Disconnect() OVERRIDE; virtual bool IsConnected() const OVERRIDE; diff --git a/jingle/notifier/base/chrome_async_socket.h b/jingle/notifier/base/chrome_async_socket.h index add9f72..a8a97f5 100644 --- a/jingle/notifier/base/chrome_async_socket.h +++ b/jingle/notifier/base/chrome_async_socket.h @@ -24,8 +24,8 @@ #include "talk/xmpp/asyncsocket.h" namespace net { -class ClientSocket; class IOBufferWithSize; +class StreamSocket; } // namespace net namespace notifier { @@ -199,7 +199,7 @@ class ChromeAsyncSocket : public buzz::AsyncSocket { // NULL iff state() == STATE_CLOSED. // // TODO(akalin): Use ClientSocketPool. - scoped_ptr<net::ClientSocket> transport_socket_; + scoped_ptr<net::StreamSocket> transport_socket_; // State for the read loop. |read_start_| <= |read_end_| <= // |read_buf_->size()|. There's a read in flight (i.e., diff --git a/jingle/notifier/base/chrome_async_socket_unittest.cc b/jingle/notifier/base/chrome_async_socket_unittest.cc index 9186d1c..f834d9d 100644 --- a/jingle/notifier/base/chrome_async_socket_unittest.cc +++ b/jingle/notifier/base/chrome_async_socket_unittest.cc @@ -130,7 +130,7 @@ class MockXmppClientSocketFactory : public ResolvingClientSocketFactory { } // ResolvingClientSocketFactory implementation. - virtual net::ClientSocket* CreateTransportClientSocket( + virtual net::StreamSocket* CreateTransportClientSocket( const net::HostPortPair& host_and_port, net::NetLog* net_log) { return mock_client_socket_factory_->CreateTransportClientSocket( address_list_, net_log, net::NetLog::Source()); diff --git a/jingle/notifier/base/fake_ssl_client_socket.cc b/jingle/notifier/base/fake_ssl_client_socket.cc index ebbad07..8838f13 100644 --- a/jingle/notifier/base/fake_ssl_client_socket.cc +++ b/jingle/notifier/base/fake_ssl_client_socket.cc @@ -77,7 +77,7 @@ base::StringPiece FakeSSLClientSocket::GetSslServerHello() { } FakeSSLClientSocket::FakeSSLClientSocket( - net::ClientSocket* transport_socket) + net::StreamSocket* transport_socket) : connect_callback_(ALLOW_THIS_IN_INITIALIZER_LIST(this), &FakeSSLClientSocket::OnConnectDone), send_client_hello_callback_( diff --git a/jingle/notifier/base/fake_ssl_client_socket.h b/jingle/notifier/base/fake_ssl_client_socket.h index 14c539b..f2282c2 100644 --- a/jingle/notifier/base/fake_ssl_client_socket.h +++ b/jingle/notifier/base/fake_ssl_client_socket.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// This ClientSocket implementation is to be used with servers that +// This StreamSocket implementation is to be used with servers that // accept connections on port 443 but don't really use SSL. For // example, the Google Talk servers do this to bypass proxies. (The // connection is upgraded to TLS as part of the XMPP negotiation, so @@ -10,7 +10,7 @@ // after connection to fool proxies into thinking that this is a real // SSL connection. // -// NOTE: This ClientSocket implementation does *not* do a real SSL +// NOTE: This StreamSocket implementation does *not* do a real SSL // handshake nor does it do any encryption! #ifndef JINGLE_NOTIFIER_BASE_FAKE_SSL_CLIENT_SOCKET_H_ @@ -25,7 +25,7 @@ #include "base/string_piece.h" #include "net/base/completion_callback.h" #include "net/base/net_errors.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace net { class DrainableIOBuffer; @@ -33,10 +33,10 @@ class DrainableIOBuffer; namespace notifier { -class FakeSSLClientSocket : public net::ClientSocket { +class FakeSSLClientSocket : public net::StreamSocket { public: // Takes ownership of |transport_socket|. - explicit FakeSSLClientSocket(net::ClientSocket* transport_socket); + explicit FakeSSLClientSocket(net::StreamSocket* transport_socket); virtual ~FakeSSLClientSocket(); @@ -44,7 +44,7 @@ class FakeSSLClientSocket : public net::ClientSocket { static base::StringPiece GetSslClientHello(); static base::StringPiece GetSslServerHello(); - // net::ClientSocket implementation. + // net::StreamSocket implementation. virtual int Read(net::IOBuffer* buf, int buf_len, net::CompletionCallback* callback); virtual int Write(net::IOBuffer* buf, int buf_len, @@ -94,7 +94,7 @@ class FakeSSLClientSocket : public net::ClientSocket { net::CompletionCallbackImpl<FakeSSLClientSocket> verify_server_hello_callback_; - scoped_ptr<net::ClientSocket> transport_socket_; + scoped_ptr<net::StreamSocket> transport_socket_; // During the handshake process, holds a value from HandshakeState. // STATE_NONE otherwise. diff --git a/jingle/notifier/base/fake_ssl_client_socket_unittest.cc b/jingle/notifier/base/fake_ssl_client_socket_unittest.cc index 7b0b58f..6f5c2da 100644 --- a/jingle/notifier/base/fake_ssl_client_socket_unittest.cc +++ b/jingle/notifier/base/fake_ssl_client_socket_unittest.cc @@ -15,8 +15,8 @@ #include "net/base/io_buffer.h" #include "net/base/net_log.h" #include "net/base/test_completion_callback.h" -#include "net/socket/client_socket.h" #include "net/socket/socket_test_util.h" +#include "net/socket/stream_socket.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -43,7 +43,7 @@ enum { }; // Used by PassThroughMethods test. -class MockClientSocket : public net::ClientSocket { +class MockClientSocket : public net::StreamSocket { public: virtual ~MockClientSocket() {} @@ -87,7 +87,7 @@ class FakeSSLClientSocketTest : public testing::Test { virtual ~FakeSSLClientSocketTest() {} - net::ClientSocket* MakeClientSocket() { + net::StreamSocket* MakeClientSocket() { return mock_client_socket_factory_.CreateTransportClientSocket( net::AddressList(), &capturing_net_log_, net::NetLog::Source()); } diff --git a/jingle/notifier/base/proxy_resolving_client_socket.h b/jingle/notifier/base/proxy_resolving_client_socket.h index 2b1b90e..f2e10e5 100644 --- a/jingle/notifier/base/proxy_resolving_client_socket.h +++ b/jingle/notifier/base/proxy_resolving_client_socket.h @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// This ClientSocket implementation wraps a ClientSocketHandle that is created +// This StreamSocket implementation wraps a ClientSocketHandle that is created // from the client socket pool after resolving proxies. #ifndef JINGLE_NOTIFIER_BASE_PROXY_RESOLVING_CLIENT_SOCKET_H_ @@ -18,7 +18,7 @@ #include "net/base/ssl_config_service.h" #include "net/proxy/proxy_info.h" #include "net/proxy/proxy_service.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace net { class ClientSocketHandle; @@ -29,7 +29,7 @@ class URLRequestContextGetter; // TODO(sanjeevr): Move this to net/ namespace notifier { -class ProxyResolvingClientSocket : public net::ClientSocket { +class ProxyResolvingClientSocket : public net::StreamSocket { public: ProxyResolvingClientSocket( const scoped_refptr<net::URLRequestContextGetter>& @@ -39,7 +39,7 @@ class ProxyResolvingClientSocket : public net::ClientSocket { net::NetLog* net_log); virtual ~ProxyResolvingClientSocket(); - // net::ClientSocket implementation. + // net::StreamSocket implementation. virtual int Read(net::IOBuffer* buf, int buf_len, net::CompletionCallback* callback) OVERRIDE; virtual int Write(net::IOBuffer* buf, int buf_len, diff --git a/jingle/notifier/base/resolving_client_socket_factory.h b/jingle/notifier/base/resolving_client_socket_factory.h index a60e22f..af05ac5 100644 --- a/jingle/notifier/base/resolving_client_socket_factory.h +++ b/jingle/notifier/base/resolving_client_socket_factory.h @@ -7,11 +7,11 @@ namespace net { -class ClientSocket; class ClientSocketHandle; class HostPortPair; class NetLog; class SSLClientSocket; +class StreamSocket; } // TODO(sanjeevr): Move this to net/ @@ -24,7 +24,7 @@ class ResolvingClientSocketFactory { public: virtual ~ResolvingClientSocketFactory() { } // Method to create a transport socket using a HostPortPair. - virtual net::ClientSocket* CreateTransportClientSocket( + virtual net::StreamSocket* CreateTransportClientSocket( const net::HostPortPair& host_and_port, net::NetLog* net_log) = 0; virtual net::SSLClientSocket* CreateSSLClientSocket( diff --git a/jingle/notifier/base/xmpp_client_socket_factory.cc b/jingle/notifier/base/xmpp_client_socket_factory.cc index 2c73de7..d3704f1 100644 --- a/jingle/notifier/base/xmpp_client_socket_factory.cc +++ b/jingle/notifier/base/xmpp_client_socket_factory.cc @@ -27,9 +27,9 @@ XmppClientSocketFactory::XmppClientSocketFactory( XmppClientSocketFactory::~XmppClientSocketFactory() {} -net::ClientSocket* XmppClientSocketFactory::CreateTransportClientSocket( +net::StreamSocket* XmppClientSocketFactory::CreateTransportClientSocket( const net::HostPortPair& host_and_port, net::NetLog* net_log) { - net::ClientSocket* transport_socket = new ProxyResolvingClientSocket( + net::StreamSocket* transport_socket = new ProxyResolvingClientSocket( request_context_getter_, ssl_config_, host_and_port, diff --git a/jingle/notifier/base/xmpp_client_socket_factory.h b/jingle/notifier/base/xmpp_client_socket_factory.h index 2f9f7eb..f09d640 100644 --- a/jingle/notifier/base/xmpp_client_socket_factory.h +++ b/jingle/notifier/base/xmpp_client_socket_factory.h @@ -12,13 +12,13 @@ #include "net/base/ssl_config_service.h" namespace net { -class ClientSocket; class ClientSocketFactory; class ClientSocketHandle; class HostPortPair; class NetLog; class SSLClientSocket; class SSLHostInfo; +class StreamSocket; class URLRequestContextGetter; } @@ -36,7 +36,7 @@ class XmppClientSocketFactory : public ResolvingClientSocketFactory { virtual ~XmppClientSocketFactory(); // ResolvingClientSocketFactory implementation. - virtual net::ClientSocket* CreateTransportClientSocket( + virtual net::StreamSocket* CreateTransportClientSocket( const net::HostPortPair& host_and_port, net::NetLog* net_log); virtual net::SSLClientSocket* CreateSSLClientSocket( diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h index f9ab1b3..69c49e3 100644 --- a/net/base/net_log_event_type_list.h +++ b/net/base/net_log_event_type_list.h @@ -228,7 +228,7 @@ EVENT_TYPE(WAITING_FOR_PROXY_RESOLVER_THREAD) EVENT_TYPE(SUBMITTED_TO_RESOLVER_THREAD) // ------------------------------------------------------------------------ -// ClientSocket +// StreamSocket // ------------------------------------------------------------------------ // The start/end of a TCP connect(). This corresponds with a call to diff --git a/net/ftp/ftp_network_transaction.cc b/net/ftp/ftp_network_transaction.cc index 885fd8f..47b672a 100644 --- a/net/ftp/ftp_network_transaction.cc +++ b/net/ftp/ftp_network_transaction.cc @@ -18,8 +18,8 @@ #include "net/ftp/ftp_network_session.h" #include "net/ftp/ftp_request_info.h" #include "net/ftp/ftp_util.h" -#include "net/socket/client_socket.h" #include "net/socket/client_socket_factory.h" +#include "net/socket/stream_socket.h" // TODO(ibrar): Try to avoid sscanf. #if !defined(COMPILER_MSVC) diff --git a/net/ftp/ftp_network_transaction.h b/net/ftp/ftp_network_transaction.h index 5a69e8e..1893190 100644 --- a/net/ftp/ftp_network_transaction.h +++ b/net/ftp/ftp_network_transaction.h @@ -21,9 +21,9 @@ namespace net { -class ClientSocket; class ClientSocketFactory; class FtpNetworkSession; +class StreamSocket; class FtpNetworkTransaction : public FtpTransaction { public: @@ -239,8 +239,8 @@ class FtpNetworkTransaction : public FtpTransaction { ClientSocketFactory* socket_factory_; - scoped_ptr<ClientSocket> ctrl_socket_; - scoped_ptr<ClientSocket> data_socket_; + scoped_ptr<StreamSocket> ctrl_socket_; + scoped_ptr<StreamSocket> data_socket_; State next_state_; }; diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 64d53ba..288d056 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -274,7 +274,7 @@ class CaptureGroupNameSocketPool : public ParentPool { virtual void CancelRequest(const std::string& group_name, ClientSocketHandle* handle) {} virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id) {} virtual void CloseIdleSockets() {} virtual int IdleSocketCount() const { diff --git a/net/http/http_proxy_client_socket.h b/net/http/http_proxy_client_socket.h index 7410fac..bd25bab 100644 --- a/net/http/http_proxy_client_socket.h +++ b/net/http/http_proxy_client_socket.h @@ -68,7 +68,7 @@ class HttpProxyClientSocket : public ProxyClientSocket { virtual const HttpResponseInfo* GetConnectResponseInfo() const; virtual HttpStream* CreateConnectResponseStream(); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/http/http_proxy_client_socket_pool.cc b/net/http/http_proxy_client_socket_pool.cc index e991f55..eb90b53 100644 --- a/net/http/http_proxy_client_socket_pool.cc +++ b/net/http/http_proxy_client_socket_pool.cc @@ -425,7 +425,7 @@ void HttpProxyClientSocketPool::CancelRequest( } void HttpProxyClientSocketPool::ReleaseSocket(const std::string& group_name, - ClientSocket* socket, int id) { + StreamSocket* socket, int id) { base_.ReleaseSocket(group_name, socket, id); } diff --git a/net/http/http_proxy_client_socket_pool.h b/net/http/http_proxy_client_socket_pool.h index 14bd9bea..c211fec 100644 --- a/net/http/http_proxy_client_socket_pool.h +++ b/net/http/http_proxy_client_socket_pool.h @@ -195,7 +195,7 @@ class HttpProxyClientSocketPool : public ClientSocketPool { ClientSocketHandle* handle); virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id); virtual void Flush(); diff --git a/net/http/http_stream_factory_impl_unittest.cc b/net/http/http_stream_factory_impl_unittest.cc index 3b76958..91bcfdb 100644 --- a/net/http/http_stream_factory_impl_unittest.cc +++ b/net/http/http_stream_factory_impl_unittest.cc @@ -155,7 +155,7 @@ class CapturePreconnectsSocketPool : public ParentPool { ADD_FAILURE(); } virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id) { ADD_FAILURE(); } diff --git a/net/http/proxy_client_socket.h b/net/http/proxy_client_socket.h index 6557c883..ea55115 100644 --- a/net/http/proxy_client_socket.h +++ b/net/http/proxy_client_socket.h @@ -6,14 +6,14 @@ #define NET_HTTP_PROXY_CLIENT_SOCKET_H_ #pragma once -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace net { class HttpStream; class HttpResponseInfo; -class ProxyClientSocket : public ClientSocket { +class ProxyClientSocket : public StreamSocket { public: ProxyClientSocket() {} virtual ~ProxyClientSocket() {} diff --git a/net/net.gyp b/net/net.gyp index 68da309..8eb2b65 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -458,8 +458,6 @@ 'proxy/proxy_service.h', 'proxy/sync_host_resolver_bridge.cc', 'proxy/sync_host_resolver_bridge.h', - 'socket/client_socket.cc', - 'socket/client_socket.h', 'socket/client_socket_factory.cc', 'socket/client_socket_factory.h', 'socket/client_socket_handle.cc', @@ -504,6 +502,8 @@ 'socket/ssl_server_socket_openssl.cc', 'socket/ssl_host_info.cc', 'socket/ssl_host_info.h', + 'socket/stream_socket.cc', + 'socket/stream_socket.h', 'socket/tcp_client_socket.cc', 'socket/tcp_client_socket.h', 'socket/tcp_client_socket_libevent.cc', diff --git a/net/socket/client_socket_factory.cc b/net/socket/client_socket_factory.cc index 966dc69..fe776bd 100644 --- a/net/socket/client_socket_factory.cc +++ b/net/socket/client_socket_factory.cc @@ -52,7 +52,7 @@ class DefaultClientSocketFactory : public ClientSocketFactory, ClearSSLSessionCache(); } - virtual ClientSocket* CreateTransportClientSocket( + virtual StreamSocket* CreateTransportClientSocket( const AddressList& addresses, NetLog* net_log, const NetLog::Source& source) { @@ -121,9 +121,9 @@ static base::LazyInstance<DefaultClientSocketFactory> } // namespace -// Deprecated function (http://crbug.com/37810) that takes a ClientSocket. +// Deprecated function (http://crbug.com/37810) that takes a StreamSocket. SSLClientSocket* ClientSocketFactory::CreateSSLClientSocket( - ClientSocket* transport_socket, + StreamSocket* transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, SSLHostInfo* ssl_host_info, diff --git a/net/socket/client_socket_factory.h b/net/socket/client_socket_factory.h index ef40ed3..31f117f 100644 --- a/net/socket/client_socket_factory.h +++ b/net/socket/client_socket_factory.h @@ -15,15 +15,15 @@ namespace net { class AddressList; class CertVerifier; -class ClientSocket; class ClientSocketHandle; class DnsCertProvenanceChecker; class HostPortPair; class SSLClientSocket; struct SSLConfig; class SSLHostInfo; +class StreamSocket; -// An interface used to instantiate ClientSocket objects. Used to facilitate +// An interface used to instantiate StreamSocket objects. Used to facilitate // testing code with mock socket implementations. class ClientSocketFactory { public: @@ -31,7 +31,7 @@ class ClientSocketFactory { // |source| is the NetLog::Source for the entity trying to create the socket, // if it has one. - virtual ClientSocket* CreateTransportClientSocket( + virtual StreamSocket* CreateTransportClientSocket( const AddressList& addresses, NetLog* net_log, const NetLog::Source& source) = 0; @@ -44,9 +44,9 @@ class ClientSocketFactory { CertVerifier* cert_verifier, DnsCertProvenanceChecker* dns_cert_checker) = 0; - // Deprecated function (http://crbug.com/37810) that takes a ClientSocket. + // Deprecated function (http://crbug.com/37810) that takes a StreamSocket. virtual SSLClientSocket* CreateSSLClientSocket( - ClientSocket* transport_socket, + StreamSocket* transport_socket, const HostPortPair& host_and_port, const SSLConfig& ssl_config, SSLHostInfo* ssl_host_info, diff --git a/net/socket/client_socket_handle.h b/net/socket/client_socket_handle.h index c66f50a..df49151 100644 --- a/net/socket/client_socket_handle.h +++ b/net/socket/client_socket_handle.h @@ -18,12 +18,12 @@ #include "net/base/net_log.h" #include "net/base/request_priority.h" #include "net/http/http_response_info.h" -#include "net/socket/client_socket.h" #include "net/socket/client_socket_pool.h" +#include "net/socket/stream_socket.h" namespace net { -// A container for a ClientSocket. +// A container for a StreamSocket. // // The handle's |group_name| uniquely identifies the origin and type of the // connection. It is used by the ClientSocketPool to group similar connected @@ -84,7 +84,7 @@ class ClientSocketHandle { // // NOTE: To prevent the socket from being kept alive, be sure to call its // Disconnect method. This will result in the ClientSocketPool deleting the - // ClientSocket. + // StreamSocket. void Reset(); // Used after Init() is called, but before the ClientSocketPool has @@ -102,7 +102,7 @@ class ClientSocketHandle { // Used by ClientSocketPool to initialize the ClientSocketHandle. void set_is_reused(bool is_reused) { is_reused_ = is_reused; } - void set_socket(ClientSocket* s) { socket_.reset(s); } + void set_socket(StreamSocket* s) { socket_.reset(s); } void set_idle_time(base::TimeDelta idle_time) { idle_time_ = idle_time; } void set_pool_id(int id) { pool_id_ = id; } void set_is_ssl_error(bool is_ssl_error) { is_ssl_error_ = is_ssl_error; } @@ -131,8 +131,8 @@ class ClientSocketHandle { // These may only be used if is_initialized() is true. const std::string& group_name() const { return group_name_; } int id() const { return pool_id_; } - ClientSocket* socket() { return socket_.get(); } - ClientSocket* release_socket() { return socket_.release(); } + StreamSocket* socket() { return socket_.get(); } + StreamSocket* release_socket() { return socket_.release(); } bool is_reused() const { return is_reused_; } base::TimeDelta idle_time() const { return idle_time_; } SocketReuseType reuse_type() const { @@ -163,7 +163,7 @@ class ClientSocketHandle { bool is_initialized_; ClientSocketPool* pool_; - scoped_ptr<ClientSocket> socket_; + scoped_ptr<StreamSocket> socket_; std::string group_name_; bool is_reused_; CompletionCallbackImpl<ClientSocketHandle> callback_; diff --git a/net/socket/client_socket_pool.h b/net/socket/client_socket_pool.h index 3066ee3..88e03ac 100644 --- a/net/socket/client_socket_pool.h +++ b/net/socket/client_socket_pool.h @@ -22,9 +22,9 @@ class DictionaryValue; namespace net { -class ClientSocket; class ClientSocketHandle; class ClientSocketPoolHistograms; +class StreamSocket; // A ClientSocketPool is used to restrict the number of sockets open at a time. // It also maintains a list of idle persistent sockets. @@ -50,7 +50,7 @@ class ClientSocketPool { // // If this function returns OK, then |handle| is initialized upon return. // The |handle|'s is_initialized method will return true in this case. If a - // ClientSocket was reused, then ClientSocketPool will call + // StreamSocket was reused, then ClientSocketPool will call // |handle|->set_reused(true). In either case, the socket will have been // allocated and will be connected. A client might want to know whether or // not the socket is reused in order to request a new socket if he encounters @@ -93,12 +93,12 @@ class ClientSocketPool { // Called to release a socket once the socket is no longer needed. If the // socket still has an established connection, then it will be added to the // set of idle sockets to be used to satisfy future RequestSocket calls. - // Otherwise, the ClientSocket is destroyed. |id| is used to differentiate + // Otherwise, the StreamSocket is destroyed. |id| is used to differentiate // between updated versions of the same pool instance. The pool's id will // change when it flushes, so it can use this |id| to discard sockets with // mismatched ids. virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id) = 0; // This flushes all state from the ClientSocketPool. This means that all diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc index e8f53af..cc4ae66 100644 --- a/net/socket/client_socket_pool_base.cc +++ b/net/socket/client_socket_pool_base.cc @@ -85,7 +85,7 @@ void ConnectJob::UseForNormalRequest() { preconnect_state_ = USED_PRECONNECT; } -void ConnectJob::set_socket(ClientSocket* socket) { +void ConnectJob::set_socket(StreamSocket* socket) { if (socket) { net_log().AddEvent(NetLog::TYPE_CONNECT_JOB_SET_SOCKET, make_scoped_refptr( new NetLogSourceParameter("source_dependency", @@ -343,7 +343,7 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal( group->AddJob(connect_job.release()); } else { LogBoundConnectJobToRequest(connect_job->net_log().source(), request); - ClientSocket* error_socket = NULL; + StreamSocket* error_socket = NULL; if (!preconnecting) { DCHECK(handle); connect_job->GetAdditionalErrorState(handle); @@ -426,7 +426,7 @@ void ClientSocketPoolBaseHelper::CancelRequest( if (callback_it != pending_callback_map_.end()) { int result = callback_it->second.result; pending_callback_map_.erase(callback_it); - ClientSocket* socket = handle->release_socket(); + StreamSocket* socket = handle->release_socket(); if (socket) { if (result != OK) socket->Disconnect(); @@ -666,7 +666,7 @@ void ClientSocketPoolBaseHelper::DecrementIdleCount() { } void ClientSocketPoolBaseHelper::ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id) { GroupMap::iterator i = group_map_.find(group_name); CHECK(i != group_map_.end()); @@ -757,7 +757,7 @@ void ClientSocketPoolBaseHelper::OnConnectJobComplete( CHECK(group_it != group_map_.end()); Group* group = group_it->second; - scoped_ptr<ClientSocket> socket(job->ReleaseSocket()); + scoped_ptr<StreamSocket> socket(job->ReleaseSocket()); BoundNetLog job_log = job->net_log(); @@ -861,7 +861,7 @@ void ClientSocketPoolBaseHelper::ProcessPendingRequest( } void ClientSocketPoolBaseHelper::HandOutSocket( - ClientSocket* socket, + StreamSocket* socket, bool reused, ClientSocketHandle* handle, base::TimeDelta idle_time, @@ -889,7 +889,7 @@ void ClientSocketPoolBaseHelper::HandOutSocket( } void ClientSocketPoolBaseHelper::AddIdleSocket( - ClientSocket* socket, Group* group) { + StreamSocket* socket, Group* group) { DCHECK(socket); IdleSocket idle_socket; idle_socket.socket = socket; diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index fe18ff2..318cab8 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -42,8 +42,8 @@ #include "net/base/net_log.h" #include "net/base/network_change_notifier.h" #include "net/base/request_priority.h" -#include "net/socket/client_socket.h" #include "net/socket/client_socket_pool.h" +#include "net/socket/stream_socket.h" namespace net { @@ -89,7 +89,7 @@ class ConnectJob { // Releases |socket_| to the client. On connection error, this should return // NULL. - ClientSocket* ReleaseSocket() { return socket_.release(); } + StreamSocket* ReleaseSocket() { return socket_.release(); } // Begins connecting the socket. Returns OK on success, ERR_IO_PENDING if it // cannot complete synchronously without blocking, or another net error code @@ -113,8 +113,8 @@ class ConnectJob { const BoundNetLog& net_log() const { return net_log_; } protected: - void set_socket(ClientSocket* socket); - ClientSocket* socket() { return socket_.get(); } + void set_socket(StreamSocket* socket); + StreamSocket* socket() { return socket_.get(); } void NotifyDelegateOfCompletion(int rv); void ResetTimer(base::TimeDelta remainingTime); @@ -138,7 +138,7 @@ class ConnectJob { // Timer to abort jobs that take too long. base::OneShotTimer<ConnectJob> timer_; Delegate* delegate_; - scoped_ptr<ClientSocket> socket_; + scoped_ptr<StreamSocket> socket_; BoundNetLog net_log_; // A ConnectJob is idle until Connect() has been called. bool idle_; @@ -236,7 +236,7 @@ class ClientSocketPoolBaseHelper // See ClientSocketPool::ReleaseSocket for documentation on this function. void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id); // See ClientSocketPool::Flush for documentation on this function. @@ -314,7 +314,7 @@ class ClientSocketPoolBaseHelper // socket for a new request. bool ShouldCleanup(base::TimeTicks now, base::TimeDelta timeout) const; - ClientSocket* socket; + StreamSocket* socket; base::TimeTicks start_time; }; @@ -445,7 +445,7 @@ class ClientSocketPoolBaseHelper void ProcessPendingRequest(const std::string& group_name, Group* group); // Assigns |socket| to |handle| and updates |group|'s counters appropriately. - void HandOutSocket(ClientSocket* socket, + void HandOutSocket(StreamSocket* socket, bool reused, ClientSocketHandle* handle, base::TimeDelta time_idle, @@ -453,7 +453,7 @@ class ClientSocketPoolBaseHelper const BoundNetLog& net_log); // Adds |socket| to the list of idle sockets for |group|. - void AddIdleSocket(ClientSocket* socket, Group* group); + void AddIdleSocket(StreamSocket* socket, Group* group); // Iterates through |group_map_|, canceling all ConnectJobs and deleting // groups if they are no longer needed. @@ -655,7 +655,7 @@ class ClientSocketPoolBase { return helper_.CancelRequest(group_name, handle); } - void ReleaseSocket(const std::string& group_name, ClientSocket* socket, + void ReleaseSocket(const std::string& group_name, StreamSocket* socket, int id) { return helper_.ReleaseSocket(group_name, socket, id); } diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index eb83289..b0d9ba1 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -18,12 +18,12 @@ #include "net/base/request_priority.h" #include "net/base/test_completion_callback.h" #include "net/http/http_response_headers.h" -#include "net/socket/client_socket.h" #include "net/socket/client_socket_factory.h" #include "net/socket/client_socket_handle.h" #include "net/socket/client_socket_pool_histograms.h" #include "net/socket/socket_test_util.h" #include "net/socket/ssl_host_info.h" +#include "net/socket/stream_socket.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -43,7 +43,7 @@ class TestSocketParams : public base::RefCounted<TestSocketParams> { }; typedef ClientSocketPoolBase<TestSocketParams> TestClientSocketPoolBase; -class MockClientSocket : public ClientSocket { +class MockClientSocket : public StreamSocket { public: MockClientSocket() : connected_(false), was_used_to_convey_data_(false) {} @@ -61,7 +61,7 @@ class MockClientSocket : public ClientSocket { virtual bool SetReceiveBufferSize(int32 size) { return true; } virtual bool SetSendBufferSize(int32 size) { return true; } - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback) { connected_ = true; @@ -103,7 +103,7 @@ class MockClientSocketFactory : public ClientSocketFactory { public: MockClientSocketFactory() : allocation_count_(0) {} - virtual ClientSocket* CreateTransportClientSocket( + virtual StreamSocket* CreateTransportClientSocket( const AddressList& addresses, NetLog* /* net_log */, const NetLog::Source& /*source*/) { @@ -416,7 +416,7 @@ class TestClientSocketPool : public ClientSocketPool { virtual void ReleaseSocket( const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id) { base_.ReleaseSocket(group_name, socket, id); } @@ -500,7 +500,7 @@ class TestConnectJobDelegate : public ConnectJob::Delegate { virtual void OnConnectJobComplete(int result, ConnectJob* job) { result_ = result; - scoped_ptr<ClientSocket> socket(job->ReleaseSocket()); + scoped_ptr<StreamSocket> socket(job->ReleaseSocket()); // socket.get() should be NULL iff result != OK EXPECT_EQ(socket.get() == NULL, result != OK); delete job; diff --git a/net/socket/deterministic_socket_data_unittest.cc b/net/socket/deterministic_socket_data_unittest.cc index af1a63d..6261d39 100644 --- a/net/socket/deterministic_socket_data_unittest.cc +++ b/net/socket/deterministic_socket_data_unittest.cc @@ -43,7 +43,7 @@ class DeterministicSocketDataTest : public PlatformTest { TestCompletionCallback read_callback_; TestCompletionCallback write_callback_; - ClientSocket* sock_; + StreamSocket* sock_; scoped_refptr<DeterministicSocketData> data_; private: diff --git a/net/socket/server_socket.h b/net/socket/server_socket.h index f037b036..4309304 100644 --- a/net/socket/server_socket.h +++ b/net/socket/server_socket.h @@ -10,8 +10,8 @@ namespace net { -class ClientSocket; class IPEndPoint; +class StreamSocket; class ServerSocket { public: @@ -27,7 +27,7 @@ class ServerSocket { // Accept connection. Callback is called when new connection is // accepted. - virtual int Accept(scoped_ptr<ClientSocket>* socket, + virtual int Accept(scoped_ptr<StreamSocket>* socket, CompletionCallback* callback) = 0; private: diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc index 577c7d2..a6d33d5 100644 --- a/net/socket/socket_test_util.cc +++ b/net/socket/socket_test_util.cc @@ -588,7 +588,7 @@ MockSSLClientSocket* MockClientSocketFactory::GetMockSSLClientSocket( return ssl_client_sockets_[index]; } -ClientSocket* MockClientSocketFactory::CreateTransportClientSocket( +StreamSocket* MockClientSocketFactory::CreateTransportClientSocket( const AddressList& addresses, net::NetLog* net_log, const NetLog::Source& source) { @@ -1180,7 +1180,7 @@ void ClientSocketPoolTest::ReleaseAllConnections(KeepAlive keep_alive) { } MockTransportClientSocketPool::MockConnectJob::MockConnectJob( - ClientSocket* socket, + StreamSocket* socket, ClientSocketHandle* handle, CompletionCallback* callback) : socket_(socket), @@ -1249,7 +1249,7 @@ int MockTransportClientSocketPool::RequestSocket(const std::string& group_name, ClientSocketHandle* handle, CompletionCallback* callback, const BoundNetLog& net_log) { - ClientSocket* socket = client_socket_factory_->CreateTransportClientSocket( + StreamSocket* socket = client_socket_factory_->CreateTransportClientSocket( AddressList(), net_log.net_log(), net::NetLog::Source()); MockConnectJob* job = new MockConnectJob(socket, handle, callback); job_list_.push_back(job); @@ -1269,7 +1269,7 @@ void MockTransportClientSocketPool::CancelRequest(const std::string& group_name, } void MockTransportClientSocketPool::ReleaseSocket(const std::string& group_name, - ClientSocket* socket, int id) { + StreamSocket* socket, int id) { EXPECT_EQ(1, id); release_count_++; delete socket; @@ -1300,7 +1300,7 @@ MockSSLClientSocket* DeterministicMockClientSocketFactory:: return ssl_client_sockets_[index]; } -ClientSocket* DeterministicMockClientSocketFactory::CreateTransportClientSocket( +StreamSocket* DeterministicMockClientSocketFactory::CreateTransportClientSocket( const AddressList& addresses, net::NetLog* net_log, const net::NetLog::Source& source) { @@ -1362,7 +1362,7 @@ void MockSOCKSClientSocketPool::CancelRequest( } void MockSOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, - ClientSocket* socket, int id) { + StreamSocket* socket, int id) { return transport_pool_->ReleaseSocket(group_name, socket, id); } diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 823c3b8..d2c986d 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -45,10 +45,10 @@ enum { ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ = -10000, }; -class ClientSocket; class MockClientSocket; class SSLClientSocket; class SSLHostInfo; +class StreamSocket; struct MockConnect { // Asynchronous connection success. @@ -468,7 +468,7 @@ class DeterministicSocketData : public StaticSocketDataProvider, bool print_debug_; }; -// Holds an array of SocketDataProvider elements. As Mock{TCP,SSL}ClientSocket +// Holds an array of SocketDataProvider elements. As Mock{TCP,SSL}StreamSocket // objects get instantiated, they take their data from the i'th element of this // array. template<typename T> @@ -533,7 +533,7 @@ class MockClientSocketFactory : public ClientSocketFactory { } // ClientSocketFactory - virtual ClientSocket* CreateTransportClientSocket( + virtual StreamSocket* CreateTransportClientSocket( const AddressList& addresses, NetLog* net_log, const NetLog::Source& source); @@ -574,7 +574,7 @@ class MockClientSocket : public net::SSLClientSocket { virtual bool SetReceiveBufferSize(int32 size); virtual bool SetSendBufferSize(int32 size); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(net::CompletionCallback* callback) = 0; virtual void Disconnect(); virtual bool IsConnected() const; @@ -617,7 +617,7 @@ class MockTCPClientSocket : public MockClientSocket { virtual int Write(net::IOBuffer* buf, int buf_len, net::CompletionCallback* callback); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(net::CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; @@ -669,7 +669,7 @@ class DeterministicMockTCPClientSocket : public MockClientSocket, virtual int Read(net::IOBuffer* buf, int buf_len, net::CompletionCallback* callback); - // ClientSocket: + // StreamSocket: virtual int Connect(net::CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; @@ -711,7 +711,7 @@ class MockSSLClientSocket : public MockClientSocket { virtual int Write(net::IOBuffer* buf, int buf_len, net::CompletionCallback* callback); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(net::CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; @@ -818,7 +818,7 @@ class MockTransportClientSocketPool : public TransportClientSocketPool { public: class MockConnectJob { public: - MockConnectJob(ClientSocket* socket, ClientSocketHandle* handle, + MockConnectJob(StreamSocket* socket, ClientSocketHandle* handle, CompletionCallback* callback); ~MockConnectJob(); @@ -828,7 +828,7 @@ class MockTransportClientSocketPool : public TransportClientSocketPool { private: void OnConnect(int rv); - scoped_ptr<ClientSocket> socket_; + scoped_ptr<StreamSocket> socket_; ClientSocketHandle* handle_; CompletionCallback* user_callback_; CompletionCallbackImpl<MockConnectJob> connect_callback_; @@ -858,7 +858,7 @@ class MockTransportClientSocketPool : public TransportClientSocketPool { virtual void CancelRequest(const std::string& group_name, ClientSocketHandle* handle); virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, int id); + StreamSocket* socket, int id); private: ClientSocketFactory* client_socket_factory_; @@ -890,7 +890,7 @@ class DeterministicMockClientSocketFactory : public ClientSocketFactory { } // ClientSocketFactory - virtual ClientSocket* CreateTransportClientSocket( + virtual StreamSocket* CreateTransportClientSocket( const AddressList& addresses, NetLog* net_log, const NetLog::Source& source); @@ -933,7 +933,7 @@ class MockSOCKSClientSocketPool : public SOCKSClientSocketPool { virtual void CancelRequest(const std::string& group_name, ClientSocketHandle* handle); virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, int id); + StreamSocket* socket, int id); private: TransportClientSocketPool* const transport_pool_; diff --git a/net/socket/socks5_client_socket.cc b/net/socket/socks5_client_socket.cc index 80b335e..7a1c10d 100644 --- a/net/socket/socks5_client_socket.cc +++ b/net/socket/socks5_client_socket.cc @@ -44,7 +44,7 @@ SOCKS5ClientSocket::SOCKS5ClientSocket( } SOCKS5ClientSocket::SOCKS5ClientSocket( - ClientSocket* transport_socket, + StreamSocket* transport_socket, const HostResolver::RequestInfo& req_info) : ALLOW_THIS_IN_INITIALIZER_LIST( io_callback_(this, &SOCKS5ClientSocket::OnIOComplete)), diff --git a/net/socket/socks5_client_socket.h b/net/socket/socks5_client_socket.h index 1981990..740be30 100644 --- a/net/socket/socks5_client_socket.h +++ b/net/socket/socks5_client_socket.h @@ -17,7 +17,7 @@ #include "net/base/host_resolver.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" #include "testing/gtest/include/gtest/gtest_prod.h" namespace net { @@ -25,9 +25,9 @@ namespace net { class ClientSocketHandle; class BoundNetLog; -// This ClientSocket is used to setup a SOCKSv5 handshake with a socks proxy. +// This StreamSocket is used to setup a SOCKSv5 handshake with a socks proxy. // Currently no SOCKSv5 authentication is supported. -class SOCKS5ClientSocket : public ClientSocket { +class SOCKS5ClientSocket : public StreamSocket { public: // Takes ownership of the |transport_socket|, which should already be // connected by the time Connect() is called. @@ -41,14 +41,14 @@ class SOCKS5ClientSocket : public ClientSocket { SOCKS5ClientSocket(ClientSocketHandle* transport_socket, const HostResolver::RequestInfo& req_info); - // Deprecated constructor (http://crbug.com/37810) that takes a ClientSocket. - SOCKS5ClientSocket(ClientSocket* transport_socket, + // Deprecated constructor (http://crbug.com/37810) that takes a StreamSocket. + SOCKS5ClientSocket(StreamSocket* transport_socket, const HostResolver::RequestInfo& req_info); // On destruction Disconnect() is called. virtual ~SOCKS5ClientSocket(); - // ClientSocket methods: + // StreamSocket methods: // Does the SOCKS handshake and completes the protocol. virtual int Connect(CompletionCallback* callback); diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index 5458411..4f99d5d 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -46,7 +46,7 @@ class SOCKS5ClientSocketTest : public PlatformTest { CapturingNetLog net_log_; scoped_ptr<SOCKS5ClientSocket> user_sock_; AddressList address_list_; - ClientSocket* tcp_sock_; + StreamSocket* tcp_sock_; TestCompletionCallback callback_; scoped_ptr<MockHostResolver> host_resolver_; scoped_ptr<SocketDataProvider> data_; diff --git a/net/socket/socks_client_socket.cc b/net/socket/socks_client_socket.cc index 1afeaa6..d885f15 100644 --- a/net/socket/socks_client_socket.cc +++ b/net/socket/socks_client_socket.cc @@ -70,7 +70,7 @@ SOCKSClientSocket::SOCKSClientSocket(ClientSocketHandle* transport_socket, net_log_(transport_socket->socket()->NetLog()) { } -SOCKSClientSocket::SOCKSClientSocket(ClientSocket* transport_socket, +SOCKSClientSocket::SOCKSClientSocket(StreamSocket* transport_socket, const HostResolver::RequestInfo& req_info, HostResolver* host_resolver) : ALLOW_THIS_IN_INITIALIZER_LIST( diff --git a/net/socket/socks_client_socket.h b/net/socket/socks_client_socket.h index 1d2cb8d..ee0cd6a 100644 --- a/net/socket/socks_client_socket.h +++ b/net/socket/socks_client_socket.h @@ -18,7 +18,7 @@ #include "net/base/host_resolver.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace net { @@ -26,7 +26,7 @@ class ClientSocketHandle; class BoundNetLog; // The SOCKS client socket implementation -class SOCKSClientSocket : public ClientSocket { +class SOCKSClientSocket : public StreamSocket { public: // Takes ownership of the |transport_socket|, which should already be // connected by the time Connect() is called. @@ -37,15 +37,15 @@ class SOCKSClientSocket : public ClientSocket { const HostResolver::RequestInfo& req_info, HostResolver* host_resolver); - // Deprecated constructor (http://crbug.com/37810) that takes a ClientSocket. - SOCKSClientSocket(ClientSocket* transport_socket, + // Deprecated constructor (http://crbug.com/37810) that takes a StreamSocket. + SOCKSClientSocket(StreamSocket* transport_socket, const HostResolver::RequestInfo& req_info, HostResolver* host_resolver); // On destruction Disconnect() is called. virtual ~SOCKSClientSocket(); - // ClientSocket methods: + // StreamSocket methods: // Does the SOCKS handshake and completes the protocol. virtual int Connect(CompletionCallback* callback); diff --git a/net/socket/socks_client_socket_pool.cc b/net/socket/socks_client_socket_pool.cc index dca2523..7b18426 100644 --- a/net/socket/socks_client_socket_pool.cc +++ b/net/socket/socks_client_socket_pool.cc @@ -239,7 +239,7 @@ void SOCKSClientSocketPool::CancelRequest(const std::string& group_name, } void SOCKSClientSocketPool::ReleaseSocket(const std::string& group_name, - ClientSocket* socket, int id) { + StreamSocket* socket, int id) { base_.ReleaseSocket(group_name, socket, id); } diff --git a/net/socket/socks_client_socket_pool.h b/net/socket/socks_client_socket_pool.h index b66caf2..bdef52f 100644 --- a/net/socket/socks_client_socket_pool.h +++ b/net/socket/socks_client_socket_pool.h @@ -99,7 +99,7 @@ class SOCKSConnectJob : public ConnectJob { State next_state_; CompletionCallbackImpl<SOCKSConnectJob> callback_; scoped_ptr<ClientSocketHandle> transport_socket_handle_; - scoped_ptr<ClientSocket> socket_; + scoped_ptr<StreamSocket> socket_; DISALLOW_COPY_AND_ASSIGN(SOCKSConnectJob); }; @@ -133,7 +133,7 @@ class SOCKSClientSocketPool : public ClientSocketPool { ClientSocketHandle* handle); virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id); virtual void Flush(); diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index 331c2bc..6cc7418 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc @@ -37,7 +37,7 @@ class SOCKSClientSocketTest : public PlatformTest { protected: scoped_ptr<SOCKSClientSocket> user_sock_; AddressList address_list_; - ClientSocket* tcp_sock_; + StreamSocket* tcp_sock_; TestCompletionCallback callback_; scoped_ptr<MockHostResolver> host_resolver_; scoped_ptr<SocketDataProvider> data_; diff --git a/net/socket/ssl_client_socket.h b/net/socket/ssl_client_socket.h index 0778e85..6de7916 100644 --- a/net/socket/ssl_client_socket.h +++ b/net/socket/ssl_client_socket.h @@ -11,7 +11,7 @@ #include "net/base/completion_callback.h" #include "net/base/load_flags.h" #include "net/base/net_errors.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace net { @@ -42,7 +42,7 @@ class DNSSECProvider { // connection is established. If a SSL error occurs during the handshake, // Connect will fail. // -class SSLClientSocket : public ClientSocket { +class SSLClientSocket : public StreamSocket { public: SSLClientSocket(); diff --git a/net/socket/ssl_client_socket_mac.h b/net/socket/ssl_client_socket_mac.h index d465cce..0a69286 100644 --- a/net/socket/ssl_client_socket_mac.h +++ b/net/socket/ssl_client_socket_mac.h @@ -45,7 +45,7 @@ class SSLClientSocketMac : public SSLClientSocket { virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); virtual NextProtoStatus GetNextProto(std::string* proto); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/socket/ssl_client_socket_nss.h b/net/socket/ssl_client_socket_nss.h index 332a421..3b6f6ad 100644 --- a/net/socket/ssl_client_socket_nss.h +++ b/net/socket/ssl_client_socket_nss.h @@ -64,7 +64,7 @@ class SSLClientSocketNSS : public SSLClientSocket { virtual NextProtoStatus GetNextProto(std::string* proto); virtual void UseDNSSEC(DNSSECProvider* provider); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/socket/ssl_client_socket_openssl.cc b/net/socket/ssl_client_socket_openssl.cc index 2198611b..156304f 100644 --- a/net/socket/ssl_client_socket_openssl.cc +++ b/net/socket/ssl_client_socket_openssl.cc @@ -622,7 +622,7 @@ void SSLClientSocketOpenSSL::DoWriteCallback(int rv) { c->Run(rv); } -// ClientSocket methods +// StreamSocket methods int SSLClientSocketOpenSSL::Connect(CompletionCallback* callback) { net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL); diff --git a/net/socket/ssl_client_socket_openssl.h b/net/socket/ssl_client_socket_openssl.h index 82d11fb..a3e6db9 100644 --- a/net/socket/ssl_client_socket_openssl.h +++ b/net/socket/ssl_client_socket_openssl.h @@ -57,7 +57,7 @@ class SSLClientSocketOpenSSL : public SSLClientSocket { virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); virtual NextProtoStatus GetNextProto(std::string* proto); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc index 41eb885..5f8daa7 100644 --- a/net/socket/ssl_client_socket_pool.cc +++ b/net/socket/ssl_client_socket_pool.cc @@ -263,7 +263,7 @@ int SSLConnectJob::DoTunnelConnectComplete(int result) { error_response_info_ = transport_socket_handle_->ssl_error_response_info(); } else if (result == ERR_PROXY_AUTH_REQUESTED || result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { - ClientSocket* socket = transport_socket_handle_->socket(); + StreamSocket* socket = transport_socket_handle_->socket(); HttpProxyClientSocket* tunnel_socket = static_cast<HttpProxyClientSocket*>(socket); error_response_info_ = *tunnel_socket->GetConnectResponseInfo(); @@ -514,7 +514,7 @@ void SSLClientSocketPool::CancelRequest(const std::string& group_name, } void SSLClientSocketPool::ReleaseSocket(const std::string& group_name, - ClientSocket* socket, int id) { + StreamSocket* socket, int id) { base_.ReleaseSocket(group_name, socket, id); } diff --git a/net/socket/ssl_client_socket_pool.h b/net/socket/ssl_client_socket_pool.h index 5c0ecb4..aa70134 100644 --- a/net/socket/ssl_client_socket_pool.h +++ b/net/socket/ssl_client_socket_pool.h @@ -210,7 +210,7 @@ class SSLClientSocketPool : public ClientSocketPool, ClientSocketHandle* handle); virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id); virtual void Flush(); diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 0849047..f436512 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -33,7 +33,7 @@ class SSLClientSocketTest : public PlatformTest { protected: net::SSLClientSocket* CreateSSLClientSocket( - net::ClientSocket* transport_socket, + net::StreamSocket* transport_socket, const net::HostPortPair& host_and_port, const net::SSLConfig& ssl_config) { return socket_factory_->CreateSSLClientSocket(transport_socket, @@ -72,7 +72,7 @@ TEST_F(SSLClientSocketTest, Connect) { TestCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -114,7 +114,7 @@ TEST_F(SSLClientSocketTest, ConnectExpired) { TestCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -157,7 +157,7 @@ TEST_F(SSLClientSocketTest, ConnectMismatched) { TestCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -202,7 +202,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthCertRequested) { TestCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -262,7 +262,7 @@ TEST_F(SSLClientSocketTest, ConnectClientAuthSendNullCert) { TestCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -312,7 +312,7 @@ TEST_F(SSLClientSocketTest, Read) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -367,7 +367,7 @@ TEST_F(SSLClientSocketTest, Read_FullDuplex) { TestCompletionCallback callback; // Used for everything except Write. TestCompletionCallback callback2; // Used for Write only. - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -422,7 +422,7 @@ TEST_F(SSLClientSocketTest, Read_SmallChunks) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -472,7 +472,7 @@ TEST_F(SSLClientSocketTest, Read_Interrupted) { ASSERT_TRUE(test_server.GetAddressList(&addr)); TestCompletionCallback callback; - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, NULL, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -542,7 +542,7 @@ TEST_F(SSLClientSocketTest, PrematureApplicationData) { net::StaticSocketDataProvider data(data_reads, arraysize(data_reads), NULL, 0); - net::ClientSocket* transport = + net::StreamSocket* transport = new net::MockTCPClientSocket(addr, NULL, &data); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) @@ -580,7 +580,7 @@ TEST_F(SSLClientSocketTest, CipherSuiteDisables) { TestCompletionCallback callback; net::CapturingNetLog log(net::CapturingNetLog::kUnbounded); - net::ClientSocket* transport = new net::TCPClientSocket( + net::StreamSocket* transport = new net::TCPClientSocket( addr, &log, net::NetLog::Source()); int rv = transport->Connect(&callback); if (rv == net::ERR_IO_PENDING) diff --git a/net/socket/ssl_client_socket_win.h b/net/socket/ssl_client_socket_win.h index 30fab5f..fb54c43 100644 --- a/net/socket/ssl_client_socket_win.h +++ b/net/socket/ssl_client_socket_win.h @@ -50,7 +50,7 @@ class SSLClientSocketWin : public SSLClientSocket { virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info); virtual NextProtoStatus GetNextProto(std::string* proto); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/socket/ssl_server_socket_unittest.cc b/net/socket/ssl_server_socket_unittest.cc index 25f386a..b3d1040 100644 --- a/net/socket/ssl_server_socket_unittest.cc +++ b/net/socket/ssl_server_socket_unittest.cc @@ -33,10 +33,10 @@ #include "net/base/ssl_config_service.h" #include "net/base/ssl_info.h" #include "net/base/x509_certificate.h" -#include "net/socket/client_socket.h" #include "net/socket/client_socket_factory.h" #include "net/socket/socket_test_util.h" #include "net/socket/ssl_client_socket.h" +#include "net/socket/stream_socket.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" @@ -100,7 +100,7 @@ class FakeDataChannel { DISALLOW_COPY_AND_ASSIGN(FakeDataChannel); }; -class FakeSocket : public ClientSocket { +class FakeSocket : public StreamSocket { public: FakeSocket(FakeDataChannel* incoming_channel, FakeDataChannel* outgoing_channel) diff --git a/net/socket/client_socket.cc b/net/socket/stream_socket.cc index 3792c5c..37482b4 100644 --- a/net/socket/client_socket.cc +++ b/net/socket/stream_socket.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" #include "base/metrics/field_trial.h" #include "base/metrics/histogram.h" @@ -47,18 +47,18 @@ Value* NetLogBytesTransferredParameter::ToValue() const { } // namespace -ClientSocket::UseHistory::UseHistory() +StreamSocket::UseHistory::UseHistory() : was_ever_connected_(false), was_used_to_convey_data_(false), omnibox_speculation_(false), subresource_speculation_(false) { } -ClientSocket::UseHistory::~UseHistory() { +StreamSocket::UseHistory::~UseHistory() { EmitPreconnectionHistograms(); } -void ClientSocket::UseHistory::Reset() { +void StreamSocket::UseHistory::Reset() { EmitPreconnectionHistograms(); was_ever_connected_ = false; was_used_to_convey_data_ = false; @@ -66,18 +66,18 @@ void ClientSocket::UseHistory::Reset() { // are intentionally preserved. } -void ClientSocket::UseHistory::set_was_ever_connected() { +void StreamSocket::UseHistory::set_was_ever_connected() { DCHECK(!was_used_to_convey_data_); was_ever_connected_ = true; } -void ClientSocket::UseHistory::set_was_used_to_convey_data() { +void StreamSocket::UseHistory::set_was_used_to_convey_data() { DCHECK(was_ever_connected_); was_used_to_convey_data_ = true; } -void ClientSocket::UseHistory::set_subresource_speculation() { +void StreamSocket::UseHistory::set_subresource_speculation() { DCHECK(was_ever_connected_); // TODO(jar): We should transition to marking a socket (or stream) at // construction time as being created for speculative reasons. This current @@ -96,19 +96,19 @@ void ClientSocket::UseHistory::set_subresource_speculation() { subresource_speculation_ = true; } -void ClientSocket::UseHistory::set_omnibox_speculation() { +void StreamSocket::UseHistory::set_omnibox_speculation() { DCHECK(was_ever_connected_); if (was_used_to_convey_data_) return; omnibox_speculation_ = true; } -bool ClientSocket::UseHistory::was_used_to_convey_data() const { +bool StreamSocket::UseHistory::was_used_to_convey_data() const { DCHECK(!was_used_to_convey_data_ || was_ever_connected_); return was_used_to_convey_data_; } -void ClientSocket::UseHistory::EmitPreconnectionHistograms() const { +void StreamSocket::UseHistory::EmitPreconnectionHistograms() const { DCHECK(!subresource_speculation_ || !omnibox_speculation_); // 0 ==> non-speculative, never connected. // 1 ==> non-speculative never used (but connected). @@ -144,7 +144,7 @@ void ClientSocket::UseHistory::EmitPreconnectionHistograms() const { } } -void ClientSocket::LogByteTransfer(const BoundNetLog& net_log, +void StreamSocket::LogByteTransfer(const BoundNetLog& net_log, NetLog::EventType event_type, int byte_count, char* bytes) const { diff --git a/net/socket/client_socket.h b/net/socket/stream_socket.h index f57fe3f..37953ec 100644 --- a/net/socket/client_socket.h +++ b/net/socket/stream_socket.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef NET_SOCKET_CLIENT_SOCKET_H_ -#define NET_SOCKET_CLIENT_SOCKET_H_ +#ifndef NET_SOCKET_STREAM_SOCKET_H_ +#define NET_SOCKET_STREAM_SOCKET_H_ #pragma once #include "net/base/net_log.h" @@ -14,9 +14,9 @@ namespace net { class AddressList; class IPEndPoint; -class ClientSocket : public Socket { +class StreamSocket : public Socket { public: - virtual ~ClientSocket() {} + virtual ~StreamSocket() {} // Called to establish a connection. Returns OK if the connection could be // established synchronously. Otherwise, ERR_IO_PENDING is returned and the @@ -71,7 +71,7 @@ class ClientSocket : public Socket { virtual void SetOmniboxSpeculation() = 0; // Returns true if the underlying transport socket ever had any reads or - // writes. ClientSockets layered on top of transport sockets should forward + // writes. StreamSockets layered on top of transport sockets should forward // this call to the transport socket. virtual bool WasEverUsed() const = 0; @@ -83,7 +83,7 @@ class ClientSocket : public Socket { // The following class is only used to gather statistics about the history of // a socket. It is only instantiated and used in basic sockets, such as // TCPClientSocket* instances. Other classes that are derived from - // ClientSocket should forward any potential settings to their underlying + // StreamSocket should forward any potential settings to their underlying // transport sockets. class UseHistory { public: @@ -130,4 +130,4 @@ class ClientSocket : public Socket { } // namespace net -#endif // NET_SOCKET_CLIENT_SOCKET_H_ +#endif // NET_SOCKET_STREAM_SOCKET_H_ diff --git a/net/socket/tcp_client_socket_libevent.h b/net/socket/tcp_client_socket_libevent.h index 89ffac1..45f24c2 100644 --- a/net/socket/tcp_client_socket_libevent.h +++ b/net/socket/tcp_client_socket_libevent.h @@ -13,7 +13,7 @@ #include "net/base/address_list.h" #include "net/base/completion_callback.h" #include "net/base/net_log.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" struct event; // From libevent @@ -22,7 +22,7 @@ namespace net { class BoundNetLog; // A client socket that uses TCP as the transport layer. -class TCPClientSocketLibevent : public ClientSocket, base::NonThreadSafe { +class TCPClientSocketLibevent : public StreamSocket, base::NonThreadSafe { public: // The IP address(es) and port number to connect to. The TCP socket will try // each IP address in the list until it succeeds in establishing a @@ -40,7 +40,7 @@ class TCPClientSocketLibevent : public ClientSocket, base::NonThreadSafe { // and for testing. void AdoptSocket(int socket); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/socket/tcp_client_socket_win.h b/net/socket/tcp_client_socket_win.h index 8beb983..9e2765a 100644 --- a/net/socket/tcp_client_socket_win.h +++ b/net/socket/tcp_client_socket_win.h @@ -12,13 +12,13 @@ #include "net/base/address_list.h" #include "net/base/completion_callback.h" #include "net/base/net_log.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace net { class BoundNetLog; -class TCPClientSocketWin : public ClientSocket, base::NonThreadSafe { +class TCPClientSocketWin : public StreamSocket, base::NonThreadSafe { public: // The IP address(es) and port number to connect to. The TCP socket will try // each IP address in the list until it succeeds in establishing a @@ -36,7 +36,7 @@ class TCPClientSocketWin : public ClientSocket, base::NonThreadSafe { // and for testing. void AdoptSocket(SOCKET socket); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/socket/tcp_server_socket_libevent.cc b/net/socket/tcp_server_socket_libevent.cc index 023b13a..b065261 100644 --- a/net/socket/tcp_server_socket_libevent.cc +++ b/net/socket/tcp_server_socket_libevent.cc @@ -111,7 +111,7 @@ int TCPServerSocketLibevent::GetLocalAddress(IPEndPoint* address) const { } int TCPServerSocketLibevent::Accept( - scoped_ptr<ClientSocket>* socket, CompletionCallback* callback) { + scoped_ptr<StreamSocket>* socket, CompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK(socket); DCHECK(callback); @@ -137,7 +137,7 @@ int TCPServerSocketLibevent::Accept( } int TCPServerSocketLibevent::AcceptInternal( - scoped_ptr<ClientSocket>* socket) { + scoped_ptr<StreamSocket>* socket) { struct sockaddr_storage addr_storage; socklen_t addr_len = sizeof(addr_storage); struct sockaddr* addr = reinterpret_cast<struct sockaddr*>(&addr_storage); diff --git a/net/socket/tcp_server_socket_libevent.h b/net/socket/tcp_server_socket_libevent.h index 9d30953..41dd40e 100644 --- a/net/socket/tcp_server_socket_libevent.h +++ b/net/socket/tcp_server_socket_libevent.h @@ -27,7 +27,7 @@ class TCPServerSocketLibevent : public ServerSocket, // net::ServerSocket implementation. virtual int Listen(const net::IPEndPoint& address, int backlog); virtual int GetLocalAddress(IPEndPoint* address) const; - virtual int Accept(scoped_ptr<ClientSocket>* socket, + virtual int Accept(scoped_ptr<StreamSocket>* socket, CompletionCallback* callback); // MessageLoopForIO::Watcher implementation. @@ -35,14 +35,14 @@ class TCPServerSocketLibevent : public ServerSocket, virtual void OnFileCanWriteWithoutBlocking(int fd); private: - int AcceptInternal(scoped_ptr<ClientSocket>* socket); + int AcceptInternal(scoped_ptr<StreamSocket>* socket); void Close(); int socket_; MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; - scoped_ptr<ClientSocket>* accept_socket_; + scoped_ptr<StreamSocket>* accept_socket_; CompletionCallback* accept_callback_; BoundNetLog net_log_; diff --git a/net/socket/tcp_server_socket_unittest.cc b/net/socket/tcp_server_socket_unittest.cc index 59fa4c0..45297fe 100644 --- a/net/socket/tcp_server_socket_unittest.cc +++ b/net/socket/tcp_server_socket_unittest.cc @@ -41,7 +41,7 @@ class TCPServerSocketTest : public PlatformTest { *address = IPEndPoint(ip_number, port); } - static IPEndPoint GetPeerAddress(ClientSocket* socket) { + static IPEndPoint GetPeerAddress(StreamSocket* socket) { AddressList address; EXPECT_EQ(OK, socket->GetPeerAddress(&address)); IPEndPoint endpoint; @@ -62,7 +62,7 @@ TEST_F(TCPServerSocketTest, Accept) { connecting_socket.Connect(&connect_callback); TestCompletionCallback accept_callback; - scoped_ptr<ClientSocket> accepted_socket; + scoped_ptr<StreamSocket> accepted_socket; int result = socket_.Accept(&accepted_socket, &accept_callback); if (result == ERR_IO_PENDING) result = accept_callback.WaitForResult(); @@ -80,7 +80,7 @@ TEST_F(TCPServerSocketTest, Accept) { // Test Accept() callback. TEST_F(TCPServerSocketTest, AcceptAsync) { TestCompletionCallback accept_callback; - scoped_ptr<ClientSocket> accepted_socket; + scoped_ptr<StreamSocket> accepted_socket; ASSERT_EQ(ERR_IO_PENDING, socket_.Accept(&accepted_socket, &accept_callback)); @@ -103,7 +103,7 @@ TEST_F(TCPServerSocketTest, AcceptAsync) { // Accept two connections simultaneously. TEST_F(TCPServerSocketTest, Accept2Connections) { TestCompletionCallback accept_callback; - scoped_ptr<ClientSocket> accepted_socket; + scoped_ptr<StreamSocket> accepted_socket; ASSERT_EQ(ERR_IO_PENDING, socket_.Accept(&accepted_socket, &accept_callback)); @@ -123,7 +123,7 @@ TEST_F(TCPServerSocketTest, Accept2Connections) { EXPECT_EQ(OK, accept_callback.WaitForResult()); TestCompletionCallback accept_callback2; - scoped_ptr<ClientSocket> accepted_socket2; + scoped_ptr<StreamSocket> accepted_socket2; int result = socket_.Accept(&accepted_socket2, &accept_callback2); if (result == ERR_IO_PENDING) result = accept_callback2.WaitForResult(); diff --git a/net/socket/tcp_server_socket_win.cc b/net/socket/tcp_server_socket_win.cc index bfebff9..bae18f2 100644 --- a/net/socket/tcp_server_socket_win.cc +++ b/net/socket/tcp_server_socket_win.cc @@ -99,7 +99,7 @@ int TCPServerSocketWin::GetLocalAddress(IPEndPoint* address) const { } int TCPServerSocketWin::Accept( - scoped_ptr<ClientSocket>* socket, CompletionCallback* callback) { + scoped_ptr<StreamSocket>* socket, CompletionCallback* callback) { DCHECK(CalledOnValidThread()); DCHECK(socket); DCHECK(callback); @@ -121,7 +121,7 @@ int TCPServerSocketWin::Accept( return result; } -int TCPServerSocketWin::AcceptInternal(scoped_ptr<ClientSocket>* socket) { +int TCPServerSocketWin::AcceptInternal(scoped_ptr<StreamSocket>* socket) { struct sockaddr_storage addr_storage; socklen_t addr_len = sizeof(addr_storage); struct sockaddr* addr = reinterpret_cast<struct sockaddr*>(&addr_storage); diff --git a/net/socket/tcp_server_socket_win.h b/net/socket/tcp_server_socket_win.h index fbe61fa..4200b4c 100644 --- a/net/socket/tcp_server_socket_win.h +++ b/net/socket/tcp_server_socket_win.h @@ -29,14 +29,14 @@ class TCPServerSocketWin : public ServerSocket, // net::ServerSocket implementation. virtual int Listen(const net::IPEndPoint& address, int backlog); virtual int GetLocalAddress(IPEndPoint* address) const; - virtual int Accept(scoped_ptr<ClientSocket>* socket, + virtual int Accept(scoped_ptr<StreamSocket>* socket, CompletionCallback* callback); // base::ObjectWatcher::Delegate implementation. virtual void OnObjectSignaled(HANDLE object); private: - int AcceptInternal(scoped_ptr<ClientSocket>* socket); + int AcceptInternal(scoped_ptr<StreamSocket>* socket); void Close(); SOCKET socket_; @@ -44,7 +44,7 @@ class TCPServerSocketWin : public ServerSocket, base::win::ObjectWatcher accept_watcher_; - scoped_ptr<ClientSocket>* accept_socket_; + scoped_ptr<StreamSocket>* accept_socket_; CompletionCallback* accept_callback_; BoundNetLog net_log_; diff --git a/net/socket/transport_client_socket_pool.cc b/net/socket/transport_client_socket_pool.cc index 54a817d..28fdb6a 100644 --- a/net/socket/transport_client_socket_pool.cc +++ b/net/socket/transport_client_socket_pool.cc @@ -73,7 +73,7 @@ TransportConnectJob::TransportConnectJob( TransportConnectJob::~TransportConnectJob() { // We don't worry about cancelling the host resolution and TCP connect, since - // ~SingleRequestHostResolver and ~ClientSocket will take care of it. + // ~SingleRequestHostResolver and ~StreamSocket will take care of it. } LoadState TransportConnectJob::GetLoadState() const { @@ -270,7 +270,7 @@ void TransportClientSocketPool::CancelRequest( void TransportClientSocketPool::ReleaseSocket( const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id) { base_.ReleaseSocket(group_name, socket, id); } diff --git a/net/socket/transport_client_socket_pool.h b/net/socket/transport_client_socket_pool.h index 1661ed6..bf7243c 100644 --- a/net/socket/transport_client_socket_pool.h +++ b/net/socket/transport_client_socket_pool.h @@ -133,7 +133,7 @@ class TransportClientSocketPool : public ClientSocketPool { ClientSocketHandle* handle); virtual void ReleaseSocket(const std::string& group_name, - ClientSocket* socket, + StreamSocket* socket, int id); virtual void Flush(); diff --git a/net/socket/transport_client_socket_pool_unittest.cc b/net/socket/transport_client_socket_pool_unittest.cc index ae937e9..4ab5994 100644 --- a/net/socket/transport_client_socket_pool_unittest.cc +++ b/net/socket/transport_client_socket_pool_unittest.cc @@ -11,12 +11,12 @@ #include "net/base/mock_host_resolver.h" #include "net/base/net_errors.h" #include "net/base/test_completion_callback.h" -#include "net/socket/client_socket.h" #include "net/socket/client_socket_factory.h" #include "net/socket/client_socket_handle.h" #include "net/socket/client_socket_pool_histograms.h" #include "net/socket/socket_test_util.h" #include "net/socket/ssl_host_info.h" +#include "net/socket/stream_socket.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { @@ -29,11 +29,11 @@ const int kMaxSockets = 32; const int kMaxSocketsPerGroup = 6; const net::RequestPriority kDefaultPriority = LOW; -class MockClientSocket : public ClientSocket { +class MockClientSocket : public StreamSocket { public: MockClientSocket() : connected_(false) {} - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback) { connected_ = true; return OK; @@ -79,11 +79,11 @@ class MockClientSocket : public ClientSocket { BoundNetLog net_log_; }; -class MockFailingClientSocket : public ClientSocket { +class MockFailingClientSocket : public StreamSocket { public: MockFailingClientSocket() {} - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback) { return ERR_CONNECTION_FAILED; } @@ -128,7 +128,7 @@ class MockFailingClientSocket : public ClientSocket { BoundNetLog net_log_; }; -class MockPendingClientSocket : public ClientSocket { +class MockPendingClientSocket : public StreamSocket { public: // |should_connect| indicates whether the socket should successfully complete // or fail. @@ -141,7 +141,7 @@ class MockPendingClientSocket : public ClientSocket { delay_ms_(delay_ms), is_connected_(false) {} - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback) { MessageLoop::current()->PostDelayedTask( FROM_HERE, @@ -226,7 +226,7 @@ class MockClientSocketFactory : public ClientSocketFactory { client_socket_types_(NULL), client_socket_index_(0), client_socket_index_max_(0) {} - virtual ClientSocket* CreateTransportClientSocket( + virtual StreamSocket* CreateTransportClientSocket( const AddressList& addresses, NetLog* /* net_log */, const NetLog::Source& /* source */) { diff --git a/net/socket/transport_client_socket_unittest.cc b/net/socket/transport_client_socket_unittest.cc index 837749e..706cde0 100644 --- a/net/socket/transport_client_socket_unittest.cc +++ b/net/socket/transport_client_socket_unittest.cc @@ -74,7 +74,7 @@ class TransportClientSocketTest int listen_port_; CapturingNetLog net_log_; ClientSocketFactory* const socket_factory_; - scoped_ptr<ClientSocket> sock_; + scoped_ptr<StreamSocket> sock_; private: scoped_refptr<ListenSocket> listen_sock_; @@ -116,7 +116,7 @@ void TransportClientSocketTest::SetUp() { } // TODO(leighton): Add SCTP to this list when it is ready. -INSTANTIATE_TEST_CASE_P(ClientSocket, +INSTANTIATE_TEST_CASE_P(StreamSocket, TransportClientSocketTest, ::testing::Values(TCP)); diff --git a/net/socket_stream/socket_stream.cc b/net/socket_stream/socket_stream.cc index cd49822..d440664 100644 --- a/net/socket_stream/socket_stream.cc +++ b/net/socket_stream/socket_stream.cc @@ -776,7 +776,7 @@ int SocketStream::DoSOCKSConnect() { next_state_ = STATE_SOCKS_CONNECT_COMPLETE; - ClientSocket* s = socket_.release(); + StreamSocket* s = socket_.release(); HostResolver::RequestInfo req_info(HostPortPair::FromURL(url_)); DCHECK(!proxy_info_.is_empty()); diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h index 9e85167..08d840c 100644 --- a/net/socket_stream/socket_stream.h +++ b/net/socket_stream/socket_stream.h @@ -300,7 +300,7 @@ class SocketStream : public base::RefCountedThreadSafe<SocketStream> { scoped_ptr<SingleRequestHostResolver> resolver_; AddressList addresses_; - scoped_ptr<ClientSocket> socket_; + scoped_ptr<StreamSocket> socket_; SSLConfig ssl_config_; diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc index 24a0ff0..c1e2d7d 100644 --- a/net/socket_stream/socket_stream_unittest.cc +++ b/net/socket_stream/socket_stream_unittest.cc @@ -188,7 +188,7 @@ class SocketStreamTest : public PlatformTest { frame.push_back('\xff'); EXPECT_TRUE(event->socket->SendData(&frame[0], frame.size())); } - // Actual ClientSocket close must happen after all frames queued by + // Actual StreamSocket close must happen after all frames queued by // SendData above are sent out. event->socket->Close(); } diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index d34743e..199df0e 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -228,13 +228,13 @@ int SpdyProxyClientSocket::Write(IOBuffer* buf, int buf_len, } bool SpdyProxyClientSocket::SetReceiveBufferSize(int32 size) { - // Since this ClientSocket sits on top of a shared SpdySession, it + // Since this StreamSocket sits on top of a shared SpdySession, it // is not safe for callers to set change this underlying socket. return false; } bool SpdyProxyClientSocket::SetSendBufferSize(int32 size) { - // Since this ClientSocket sits on top of a shared SpdySession, it + // Since this StreamSocket sits on top of a shared SpdySession, it // is not safe for callers to set change this underlying socket. return false; } diff --git a/net/spdy/spdy_proxy_client_socket.h b/net/spdy/spdy_proxy_client_socket.h index 6f506d7..4dc6e23 100644 --- a/net/spdy/spdy_proxy_client_socket.h +++ b/net/spdy/spdy_proxy_client_socket.h @@ -67,7 +67,7 @@ class SpdyProxyClientSocket : public ProxyClientSocket, // the response body. virtual HttpStream* CreateConnectResponseStream(); - // ClientSocket methods: + // StreamSocket methods: virtual int Connect(CompletionCallback* callback); virtual void Disconnect(); virtual bool IsConnected() const; diff --git a/net/spdy/spdy_session.h b/net/spdy/spdy_session.h index 46d1903..9cd9038 100644 --- a/net/spdy/spdy_session.h +++ b/net/spdy/spdy_session.h @@ -23,8 +23,8 @@ #include "net/base/request_priority.h" #include "net/base/ssl_config_service.h" #include "net/base/upload_data_stream.h" -#include "net/socket/client_socket.h" #include "net/socket/client_socket_handle.h" +#include "net/socket/stream_socket.h" #include "net/spdy/spdy_framer.h" #include "net/spdy/spdy_io_buffer.h" #include "net/spdy/spdy_protocol.h" diff --git a/net/udp/udp_socket_libevent.h b/net/udp/udp_socket_libevent.h index e33e9fd..55d4cca 100644 --- a/net/udp/udp_socket_libevent.h +++ b/net/udp/udp_socket_libevent.h @@ -13,7 +13,7 @@ #include "net/base/completion_callback.h" #include "net/base/ip_endpoint.h" #include "net/base/net_log.h" -#include "net/socket/client_socket.h" +#include "net/socket/stream_socket.h" namespace net { diff --git a/remoting/jingle_glue/ssl_socket_adapter.h b/remoting/jingle_glue/ssl_socket_adapter.h index c4111c8..279e9e1 100644 --- a/remoting/jingle_glue/ssl_socket_adapter.h +++ b/remoting/jingle_glue/ssl_socket_adapter.h @@ -10,8 +10,8 @@ #include "net/base/io_buffer.h" #include "net/base/net_errors.h" #include "net/base/net_log.h" -#include "net/socket/client_socket.h" #include "net/socket/ssl_client_socket.h" +#include "net/socket/stream_socket.h" #include "third_party/libjingle/source/talk/base/asyncsocket.h" #include "third_party/libjingle/source/talk/base/ssladapter.h" @@ -26,10 +26,10 @@ class SSLSocketAdapter; // TODO(sergeyu): Write unittests for this code! // This class provides a wrapper to libjingle's talk_base::AsyncSocket that -// implements Chromium's net::ClientSocket interface. It's used by +// implements Chromium's net::StreamSocket interface. It's used by // SSLSocketAdapter to enable Chromium's SSL implementation to work over // libjingle's socket class. -class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { +class TransportSocket : public net::StreamSocket, public sigslot::has_slots<> { public: TransportSocket(talk_base::AsyncSocket* socket, SSLSocketAdapter *ssl_adapter); @@ -39,7 +39,7 @@ class TransportSocket : public net::ClientSocket, public sigslot::has_slots<> { addr_ = addr; } - // net::ClientSocket implementation + // net::StreamSocket implementation virtual int Connect(net::CompletionCallback* callback); virtual void Disconnect(); diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc index a53aeb4..0f50bab 100644 --- a/remoting/protocol/jingle_session.cc +++ b/remoting/protocol/jingle_session.cc @@ -41,7 +41,7 @@ const char kVideoRtcpChannelName[] = "videortcp"; // Helper method to create a SSL client socket. net::SSLClientSocket* CreateSSLClientSocket( - net::ClientSocket* socket, scoped_refptr<net::X509Certificate> cert, + net::StreamSocket* socket, scoped_refptr<net::X509Certificate> cert, net::CertVerifier* cert_verifier) { net::SSLConfig ssl_config; ssl_config.false_start_enabled = false; diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h index d919d56..122aec8 100644 --- a/remoting/protocol/jingle_session.h +++ b/remoting/protocol/jingle_session.h @@ -20,9 +20,9 @@ class TransportChannelSocketAdapter; namespace net { class CertVerifier; -class ClientSocket; class ClientSocketFactory; class Socket; +class StreamSocket; class X509Certificate; } // namespace net |