Index: net/socket/client_socket_pool_base.cc |
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc |
index b03dded83dd283b38cccd5d94753436fb028c624..df27d1566e360fd85c74b68e48986960f896ebfe 100644 |
--- a/net/socket/client_socket_pool_base.cc |
+++ b/net/socket/client_socket_pool_base.cc |
@@ -27,24 +27,6 @@ namespace net { |
namespace { |
-// Indicate whether we should enable idle socket cleanup timer. When timer is |
-// disabled, sockets are closed next time a socket request is made. |
-// Keep this enabled for windows as long as we support Windows XP, see the note |
-// in kCleanupInterval below. |
-#if defined(OS_WIN) |
-bool g_cleanup_timer_enabled = true; |
-#else |
-bool g_cleanup_timer_enabled = false; |
-#endif |
- |
-// The timeout value, in seconds, used to clean up idle sockets that can't be |
-// reused. |
-// |
-// Note: It's important to close idle sockets that have received data as soon |
-// as possible because the received data may cause BSOD on Windows XP under |
-// some conditions. See http://crbug.com/4606. |
-const int kCleanupInterval = 10; // DO NOT INCREASE THIS TIMEOUT. |
- |
// Indicate whether or not we should establish a new transport layer connection |
// after a certain timeout has passed without receiving an ACK. |
bool g_connect_backup_jobs_enabled = true; |
@@ -178,7 +160,6 @@ ClientSocketPoolBaseHelper::ClientSocketPoolBaseHelper( |
handed_out_socket_count_(0), |
max_sockets_(max_sockets), |
max_sockets_per_group_(max_sockets_per_group), |
- use_cleanup_timer_(g_cleanup_timer_enabled), |
unused_idle_socket_timeout_(unused_idle_socket_timeout), |
used_idle_socket_timeout_(used_idle_socket_timeout), |
connect_job_factory_(connect_job_factory), |
@@ -283,9 +264,8 @@ int ClientSocketPoolBaseHelper::RequestSocket( |
CHECK(!request->callback().is_null()); |
CHECK(request->handle()); |
- // Cleanup any timed-out idle sockets if no timer is used. |
- if (!use_cleanup_timer_) |
- CleanupIdleSockets(false); |
+ // Cleanup any timed-out idle sockets. |
+ CleanupIdleSockets(false); |
request->net_log().BeginEvent(NetLog::TYPE_SOCKET_POOL); |
Group* group = GetOrCreateGroup(group_name); |
@@ -319,9 +299,8 @@ void ClientSocketPoolBaseHelper::RequestSockets( |
DCHECK(request.callback().is_null()); |
DCHECK(!request.handle()); |
- // Cleanup any timed out idle sockets if no timer is used. |
- if (!use_cleanup_timer_) |
- CleanupIdleSockets(false); |
+ // Cleanup any timed-out idle sockets. |
+ CleanupIdleSockets(false); |
if (num_sockets > max_sockets_per_group_) { |
num_sockets = max_sockets_per_group_; |
@@ -756,30 +735,11 @@ void ClientSocketPoolBaseHelper::EnableConnectBackupJobs() { |
} |
void ClientSocketPoolBaseHelper::IncrementIdleCount() { |
- if (++idle_socket_count_ == 1 && use_cleanup_timer_) |
- StartIdleSocketTimer(); |
+ ++idle_socket_count_; |
} |
void ClientSocketPoolBaseHelper::DecrementIdleCount() { |
- if (--idle_socket_count_ == 0) |
- timer_.Stop(); |
-} |
- |
-// static |
-bool ClientSocketPoolBaseHelper::cleanup_timer_enabled() { |
- return g_cleanup_timer_enabled; |
-} |
- |
-// static |
-bool ClientSocketPoolBaseHelper::set_cleanup_timer_enabled(bool enabled) { |
- bool old_value = g_cleanup_timer_enabled; |
- g_cleanup_timer_enabled = enabled; |
- return old_value; |
-} |
- |
-void ClientSocketPoolBaseHelper::StartIdleSocketTimer() { |
- timer_.Start(FROM_HERE, TimeDelta::FromSeconds(kCleanupInterval), this, |
- &ClientSocketPoolBaseHelper::OnCleanupTimerFired); |
+ --idle_socket_count_; |
} |
void ClientSocketPoolBaseHelper::ReleaseSocket( |