summaryrefslogtreecommitdiffstats
path: root/net/socket/client_socket_pool_base.h
diff options
context:
space:
mode:
authorvandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 17:17:26 +0000
committervandebo@chromium.org <vandebo@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-22 17:17:26 +0000
commita796bcec176ca3875a55346800b3a60a83e2dd89 (patch)
tree2533c17673ff50f4f101e803c2dff3bf8f5cbf7b /net/socket/client_socket_pool_base.h
parent35818452760c23c570b7947e00a3b38e733ce58e (diff)
downloadchromium_src-a796bcec176ca3875a55346800b3a60a83e2dd89.zip
chromium_src-a796bcec176ca3875a55346800b3a60a83e2dd89.tar.gz
chromium_src-a796bcec176ca3875a55346800b3a60a83e2dd89.tar.bz2
Implement SOCKSClientSocketPool
This is the first layered pool, so there are several infrastructure changes in this change as well. Add a ConnectionTimeout method to pools so that layered pools can timeout each phase. Add a name method to pools to support per pool UMA histograms. Change SOCKS sockets to take a ClientSocketHandle instead of a ClientSocket BUG=30357 (blocks an SSL Pool) TEST=existing unit tests Review URL: http://codereview.chromium.org/668097 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42231 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/client_socket_pool_base.h')
-rw-r--r--net/socket/client_socket_pool_base.h28
1 files changed, 26 insertions, 2 deletions
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h
index 08fb0f0..d1abd58 100644
--- a/net/socket/client_socket_pool_base.h
+++ b/net/socket/client_socket_pool_base.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
@@ -94,6 +94,7 @@ class ConnectJob {
void set_socket(ClientSocket* socket) { socket_.reset(socket); }
ClientSocket* socket() { return socket_.get(); }
void NotifyDelegateOfCompletion(int rv);
+ void ResetTimer(base::TimeDelta remainingTime);
private:
virtual int ConnectInternal() = 0;
@@ -158,6 +159,8 @@ class ClientSocketPoolBaseHelper
ConnectJob::Delegate* delegate,
const BoundNetLog& net_log) const = 0;
+ virtual base::TimeDelta ConnectionTimeout() const = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory);
};
@@ -222,6 +225,10 @@ class ClientSocketPoolBaseHelper
// sockets that timed out or can't be reused. Made public for testing.
void CleanupIdleSockets(bool force);
+ base::TimeDelta ConnectionTimeout() const {
+ return connect_job_factory_->ConnectionTimeout();
+ }
+
void enable_backup_jobs() { backup_jobs_enabled_ = true; };
private:
@@ -477,6 +484,8 @@ class ClientSocketPoolBase {
ConnectJob::Delegate* delegate,
const BoundNetLog& net_log) const = 0;
+ virtual base::TimeDelta ConnectionTimeout() const = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory);
};
@@ -490,11 +499,13 @@ class ClientSocketPoolBase {
ClientSocketPoolBase(
int max_sockets,
int max_sockets_per_group,
+ const std::string& name,
base::TimeDelta unused_idle_socket_timeout,
base::TimeDelta used_idle_socket_timeout,
ConnectJobFactory* connect_job_factory,
NetworkChangeNotifier* network_change_notifier)
- : helper_(new internal::ClientSocketPoolBaseHelper(
+ : name_(name),
+ helper_(new internal::ClientSocketPoolBaseHelper(
max_sockets, max_sockets_per_group,
unused_idle_socket_timeout, used_idle_socket_timeout,
new ConnectJobFactoryAdaptor(connect_job_factory),
@@ -560,6 +571,12 @@ class ClientSocketPoolBase {
return helper_->CleanupIdleSockets(force);
}
+ base::TimeDelta ConnectionTimeout() const {
+ return helper_->ConnectionTimeout();
+ }
+
+ const std::string& name() const { return name_; }
+
void enable_backup_jobs() { helper_->enable_backup_jobs(); };
private:
@@ -589,9 +606,16 @@ class ClientSocketPoolBase {
group_name, *casted_request, delegate, net_log);
}
+ virtual base::TimeDelta ConnectionTimeout() const {
+ return connect_job_factory_->ConnectionTimeout();
+ }
+
const scoped_ptr<ConnectJobFactory> connect_job_factory_;
};
+ // Name of this pool.
+ const std::string name_;
+
// One might ask why ClientSocketPoolBaseHelper is also refcounted if its
// containing ClientSocketPool is already refcounted. The reason is because
// DoReleaseSocket() posts a task. If ClientSocketPool gets deleted between