diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 22:12:54 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 22:12:54 +0000 |
commit | 875a609190a37ed30823b846d17add15e85eb791 (patch) | |
tree | af65e65944ffb78cd325771e856d85b7f058ee8c /net/socket/client_socket_pool_base.h | |
parent | d426d49023aa47f469ec78e87ebb0a1945c50137 (diff) | |
download | chromium_src-875a609190a37ed30823b846d17add15e85eb791.zip chromium_src-875a609190a37ed30823b846d17add15e85eb791.tar.gz chromium_src-875a609190a37ed30823b846d17add15e85eb791.tar.bz2 |
Add timeouts for ConnectJobs. Limit ConnectJobs per group to number of Requests per group + 1.
In the histograms for Net.SocketRequestTime, late binding has a much longer tail. This is presumably because I didn't implement timeouts and CancelRequest() never cancelled jobs. I'm limiting TCPConnectJobs to 30 seconds and cancelling jobs if there are too many more than there are requests.
Review URL: http://codereview.chromium.org/160499
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22330 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/client_socket_pool_base.h')
-rw-r--r-- | net/socket/client_socket_pool_base.h | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/net/socket/client_socket_pool_base.h b/net/socket/client_socket_pool_base.h index 51b2139..21cd642 100644 --- a/net/socket/client_socket_pool_base.h +++ b/net/socket/client_socket_pool_base.h @@ -43,10 +43,8 @@ class ConnectJob { DISALLOW_COPY_AND_ASSIGN(Delegate); }; - // A |timeout_duration| of 0 corresponds to no timeout. ConnectJob(const std::string& group_name, const ClientSocketHandle* key_handle, - base::TimeDelta timeout_duration, Delegate* delegate); virtual ~ConnectJob(); @@ -65,7 +63,7 @@ class ConnectJob { // |delegate_| via OnConnectJobComplete. In both asynchronous and synchronous // completion, ReleaseSocket() can be called to acquire the connected socket // if it succeeded. - int Connect(); + virtual int Connect() = 0; protected: void set_load_state(LoadState load_state) { load_state_ = load_state; } @@ -74,18 +72,10 @@ class ConnectJob { Delegate* delegate() { return delegate_; } private: - virtual int ConnectInternal() = 0; - - // Alerts the delegate that the ConnectJob has timed out. - void OnTimeout(); - const std::string group_name_; // Temporarily needed until we switch to late binding. const ClientSocketHandle* const key_handle_; - const base::TimeDelta timeout_duration_; - // Timer to abort jobs that take too long. - base::OneShotTimer<ConnectJob> timer_; - Delegate* delegate_; + Delegate* const delegate_; LoadState load_state_; scoped_ptr<ClientSocket> socket_; @@ -178,9 +168,6 @@ class ClientSocketPoolBase // For testing. bool may_have_stalled_group() const { return may_have_stalled_group_; } - int NumConnectJobsInGroup(const std::string& group_name) const { - return group_map_.find(group_name)->second.jobs.size(); - } private: // Entry for a persistent socket which became idle at time |start_time|. @@ -265,7 +252,7 @@ class ClientSocketPoolBase // binding is enabled. |job| must be non-NULL when late binding is // enabled. Also updates |group| if non-NULL. void RemoveConnectJob(const ClientSocketHandle* handle, - const ConnectJob* job, + ConnectJob* job, Group* group); // Same as OnAvailableSocketSlot except it looks up the Group first to see if |