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 /net/socket | |
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
Diffstat (limited to 'net/socket')
42 files changed, 157 insertions, 157 deletions
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)); |