summaryrefslogtreecommitdiffstats
path: root/net/base/client_socket_pool.h
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-28 20:50:12 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-28 20:50:12 +0000
commitaeab57ea8560065d6c513fcd46bb43e1bfbfd7a6 (patch)
treea63f2d36e86361d5c27122a6d6ef4098b755d7d9 /net/base/client_socket_pool.h
parente115558691eb08608fad56bb32f40265fdfa4ac5 (diff)
downloadchromium_src-aeab57ea8560065d6c513fcd46bb43e1bfbfd7a6.zip
chromium_src-aeab57ea8560065d6c513fcd46bb43e1bfbfd7a6.tar.gz
chromium_src-aeab57ea8560065d6c513fcd46bb43e1bfbfd7a6.tar.bz2
Simplify OneShotTimer and RepeatingTimer. Fix up all consumers.
Major changes: OneShotTimer and RepeatingTimer become template classes that no longer require a Task or a Timer object. They just use PostDelayedTask. Under the hood that still uses a Timer object. The API is much simpler for consumers as they now no longer need to worry about allocating a Task or managing the lifetime of the object pointer held by the Task. I added some new unit tests to timer_unittest.cc to cover the API. I preserved the old TimerManager / Timer API for now, but I plan to soon kill it. R=brettw BUG=1346553 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1502 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/client_socket_pool.h')
-rw-r--r--net/base/client_socket_pool.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/net/base/client_socket_pool.h b/net/base/client_socket_pool.h
index 99e4936..4b89705 100644
--- a/net/base/client_socket_pool.h
+++ b/net/base/client_socket_pool.h
@@ -25,8 +25,7 @@ class ClientSocketHandle;
// not responsible for allocating the associated ClientSocket objects. The
// consumer must do so if it gets a scoped_ptr<ClientSocket> with a null value.
//
-class ClientSocketPool : public base::RefCounted<ClientSocketPool>,
- public Task {
+class ClientSocketPool : public base::RefCounted<ClientSocketPool> {
public:
explicit ClientSocketPool(int max_sockets_per_group);
@@ -85,9 +84,9 @@ class ClientSocketPool : public base::RefCounted<ClientSocketPool>,
// Called via PostTask by ReleaseSocket.
void DoReleaseSocket(const std::string& group_name, ClientSocketPtr* ptr);
- // Task implementation. This method scans the idle sockets checking to see
- // if any have been disconnected.
- virtual void Run();
+ // Called when timer_ fires. This method scans the idle sockets checking to
+ // see if any have been disconnected.
+ void DoTimeout();
// A Request is allocated per call to RequestSocket that results in
// ERR_IO_PENDING.
@@ -109,13 +108,15 @@ class ClientSocketPool : public base::RefCounted<ClientSocketPool>,
GroupMap group_map_;
// Timer used to periodically prune sockets that have been disconnected.
- RepeatingTimer timer_;
+ base::RepeatingTimer<ClientSocketPool> timer_;
// The total number of idle sockets in the system.
int idle_socket_count_;
// The maximum number of sockets kept per group.
int max_sockets_per_group_;
+
+ DISALLOW_COPY_AND_ASSIGN(ClientSocketPool);
};
} // namespace net