| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/client_socket_pool.h" | 5 #include "net/socket/client_socket_pool.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 | 10 |
| 11 // The maximum duration, in seconds, to keep unused idle persistent sockets | 11 // The maximum duration, in seconds, to keep unused idle persistent sockets |
| 12 // alive. | 12 // alive. |
| 13 // TODO(ziadh): Change this timeout after getting histogram data on how long it | 13 // TODO(ziadh): Change this timeout after getting histogram data on how long it |
| 14 // should be. | 14 // should be. |
| 15 int64_t g_unused_idle_socket_timeout_s = 10; | 15 int64_t g_unused_idle_socket_timeout_s = 10; |
| 16 | 16 |
| 17 // The maximum duration, in seconds, to keep used idle persistent sockets alive. | 17 // The maximum duration, in seconds, to keep used idle persistent sockets alive. |
| 18 int64_t g_used_idle_socket_timeout_s = 300; // 5 minutes | 18 int64_t g_used_idle_socket_timeout_s = 300; // 5 minutes |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 void ClientSocketPool::PopulateAllocatorDump( |
| 25 base::trace_event::MemoryAllocatorDump* dump) const {} |
| 26 |
| 24 // static | 27 // static |
| 25 base::TimeDelta ClientSocketPool::unused_idle_socket_timeout() { | 28 base::TimeDelta ClientSocketPool::unused_idle_socket_timeout() { |
| 26 return base::TimeDelta::FromSeconds(g_unused_idle_socket_timeout_s); | 29 return base::TimeDelta::FromSeconds(g_unused_idle_socket_timeout_s); |
| 27 } | 30 } |
| 28 | 31 |
| 29 // static | 32 // static |
| 30 void ClientSocketPool::set_unused_idle_socket_timeout(base::TimeDelta timeout) { | 33 void ClientSocketPool::set_unused_idle_socket_timeout(base::TimeDelta timeout) { |
| 31 DCHECK_GT(timeout.InSeconds(), 0); | 34 DCHECK_GT(timeout.InSeconds(), 0); |
| 32 g_unused_idle_socket_timeout_s = timeout.InSeconds(); | 35 g_unused_idle_socket_timeout_s = timeout.InSeconds(); |
| 33 } | 36 } |
| 34 | 37 |
| 35 // static | 38 // static |
| 36 base::TimeDelta ClientSocketPool::used_idle_socket_timeout() { | 39 base::TimeDelta ClientSocketPool::used_idle_socket_timeout() { |
| 37 return base::TimeDelta::FromSeconds(g_used_idle_socket_timeout_s); | 40 return base::TimeDelta::FromSeconds(g_used_idle_socket_timeout_s); |
| 38 } | 41 } |
| 39 | 42 |
| 40 // static | 43 // static |
| 41 void ClientSocketPool::set_used_idle_socket_timeout(base::TimeDelta timeout) { | 44 void ClientSocketPool::set_used_idle_socket_timeout(base::TimeDelta timeout) { |
| 42 DCHECK_GT(timeout.InSeconds(), 0); | 45 DCHECK_GT(timeout.InSeconds(), 0); |
| 43 g_used_idle_socket_timeout_s = timeout.InSeconds(); | 46 g_used_idle_socket_timeout_s = timeout.InSeconds(); |
| 44 } | 47 } |
| 45 | 48 |
| 46 ClientSocketPool::ClientSocketPool() {} | 49 ClientSocketPool::ClientSocketPool() {} |
| 47 | 50 |
| 48 ClientSocketPool::~ClientSocketPool() {} | 51 ClientSocketPool::~ClientSocketPool() {} |
| 49 | 52 |
| 50 } // namespace net | 53 } // namespace net |
| OLD | NEW |