summaryrefslogtreecommitdiffstats
path: root/net/socket/tcp_client_socket_pool.h
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 07:07:49 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-14 07:07:49 +0000
commitd80a432e2201c81d60508d8399129063baa63982 (patch)
tree00106740b6f9547148411a97fcc1328cc66b13c7 /net/socket/tcp_client_socket_pool.h
parentb8c904a326b28ad76146ab2a7366b2bbc2edaab9 (diff)
downloadchromium_src-d80a432e2201c81d60508d8399129063baa63982.zip
chromium_src-d80a432e2201c81d60508d8399129063baa63982.tar.gz
chromium_src-d80a432e2201c81d60508d8399129063baa63982.tar.bz2
Make ClientSocketPool/ClientSocketPoolBase/ClientSocketHandle more generic.
This is in preparation for creating an SSLClientSocketPool. ClientSocketPoolBase is now templated. Most of the implementation has moved to ClientSocketPoolBaseHelper which is not templated. In order to make this possible, ClientSocketPoolBaseHelper's internal data structures do not use the full concrete Request type, but rather use a pointer to Request. ClientSocketPoolBase takes a SocketParams as a template argument, primarily to allow RequestSocket to take a templated parameter that contains all the information necessary to connect the socket (be it TCP or SSL or whatever). ClientSocketPool::RequestSocket() and ClientSocketHandle::Init() have been templated as well to handle this case. I've left adding run-time type safety checks as a TODO. TEST=net_unittests BUG=http://crbug.com/13289 Review URL: http://codereview.chromium.org/160621 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23427 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/tcp_client_socket_pool.h')
-rw-r--r--net/socket/tcp_client_socket_pool.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/net/socket/tcp_client_socket_pool.h b/net/socket/tcp_client_socket_pool.h
index 8533d0e..4532000 100644
--- a/net/socket/tcp_client_socket_pool.h
+++ b/net/socket/tcp_client_socket_pool.h
@@ -81,7 +81,7 @@ class TCPClientSocketPool : public ClientSocketPool {
// ClientSocketPool methods:
virtual int RequestSocket(const std::string& group_name,
- const HostResolver::RequestInfo& resolve_info,
+ const void* resolve_info,
int priority,
ClientSocketHandle* handle,
CompletionCallback* callback,
@@ -96,7 +96,7 @@ class TCPClientSocketPool : public ClientSocketPool {
virtual void CloseIdleSockets();
virtual int IdleSocketCount() const {
- return base_->idle_socket_count();
+ return base_.idle_socket_count();
}
virtual int IdleSocketCountInGroup(const std::string& group_name) const;
@@ -105,10 +105,10 @@ class TCPClientSocketPool : public ClientSocketPool {
const ClientSocketHandle* handle) const;
private:
- virtual ~TCPClientSocketPool();
+ typedef ClientSocketPoolBase<HostResolver::RequestInfo> PoolBase;
class TCPConnectJobFactory
- : public ClientSocketPoolBase::ConnectJobFactory {
+ : public PoolBase::ConnectJobFactory {
public:
TCPConnectJobFactory(ClientSocketFactory* client_socket_factory,
HostResolver* host_resolver)
@@ -121,7 +121,7 @@ class TCPClientSocketPool : public ClientSocketPool {
virtual ConnectJob* NewConnectJob(
const std::string& group_name,
- const ClientSocketPoolBase::Request& request,
+ const PoolBase::Request& request,
ConnectJob::Delegate* delegate) const;
private:
@@ -131,12 +131,9 @@ class TCPClientSocketPool : public ClientSocketPool {
DISALLOW_COPY_AND_ASSIGN(TCPConnectJobFactory);
};
- // One might ask why ClientSocketPoolBase is also refcounted if its
- // containing ClientSocketPool is already refcounted. The reason is because
- // DoReleaseSocket() posts a task. If ClientSocketPool gets deleted between
- // the posting of the task and the execution, then we'll hit the DCHECK that
- // |ClientSocketPoolBase::group_map_| is empty.
- scoped_refptr<ClientSocketPoolBase> base_;
+ virtual ~TCPClientSocketPool();
+
+ PoolBase base_;
DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool);
};