| 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 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/template_util.h" | 14 #include "base/template_util.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/load_states.h" | 17 #include "net/base/load_states.h" |
| 18 #include "net/base/net_export.h" | 18 #include "net/base/net_export.h" |
| 19 #include "net/base/request_priority.h" | 19 #include "net/base/request_priority.h" |
| 20 #include "net/dns/host_resolver.h" | 20 #include "net/dns/host_resolver.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class DictionaryValue; | 23 class DictionaryValue; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace net { | 26 namespace net { |
| 27 | 27 |
| 28 class ClientSocketHandle; | 28 class ClientSocketHandle; |
| 29 class ClientSocketPoolHistograms; | |
| 30 class StreamSocket; | 29 class StreamSocket; |
| 31 | 30 |
| 32 // ClientSocketPools are layered. This defines an interface for lower level | 31 // ClientSocketPools are layered. This defines an interface for lower level |
| 33 // socket pools to communicate with higher layer pools. | 32 // socket pools to communicate with higher layer pools. |
| 34 class NET_EXPORT HigherLayeredPool { | 33 class NET_EXPORT HigherLayeredPool { |
| 35 public: | 34 public: |
| 36 virtual ~HigherLayeredPool() {} | 35 virtual ~HigherLayeredPool() {} |
| 37 | 36 |
| 38 // Instructs the HigherLayeredPool to close an idle connection. Return true if | 37 // Instructs the HigherLayeredPool to close an idle connection. Return true if |
| 39 // one was closed. Closing an idle connection will call into the lower layer | 38 // one was closed. Closing an idle connection will call into the lower layer |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // If |include_nested_pools| is true, the states of any nested | 162 // If |include_nested_pools| is true, the states of any nested |
| 164 // ClientSocketPools will be included. | 163 // ClientSocketPools will be included. |
| 165 virtual base::DictionaryValue* GetInfoAsValue( | 164 virtual base::DictionaryValue* GetInfoAsValue( |
| 166 const std::string& name, | 165 const std::string& name, |
| 167 const std::string& type, | 166 const std::string& type, |
| 168 bool include_nested_pools) const = 0; | 167 bool include_nested_pools) const = 0; |
| 169 | 168 |
| 170 // Returns the maximum amount of time to wait before retrying a connect. | 169 // Returns the maximum amount of time to wait before retrying a connect. |
| 171 static const int kMaxConnectRetryIntervalMs = 250; | 170 static const int kMaxConnectRetryIntervalMs = 250; |
| 172 | 171 |
| 173 // The set of histograms specific to this pool. We can't use the standard | |
| 174 // UMA_HISTOGRAM_* macros because they are callsite static. | |
| 175 virtual ClientSocketPoolHistograms* histograms() const = 0; | |
| 176 | |
| 177 static base::TimeDelta unused_idle_socket_timeout(); | 172 static base::TimeDelta unused_idle_socket_timeout(); |
| 178 static void set_unused_idle_socket_timeout(base::TimeDelta timeout); | 173 static void set_unused_idle_socket_timeout(base::TimeDelta timeout); |
| 179 | 174 |
| 180 static base::TimeDelta used_idle_socket_timeout(); | 175 static base::TimeDelta used_idle_socket_timeout(); |
| 181 static void set_used_idle_socket_timeout(base::TimeDelta timeout); | 176 static void set_used_idle_socket_timeout(base::TimeDelta timeout); |
| 182 | 177 |
| 183 protected: | 178 protected: |
| 184 ClientSocketPool(); | 179 ClientSocketPool(); |
| 185 ~ClientSocketPool() override; | 180 ~ClientSocketPool() override; |
| 186 | 181 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 197 const std::string& group_name, | 192 const std::string& group_name, |
| 198 const scoped_refptr<typename PoolType::SocketParams>& params, | 193 const scoped_refptr<typename PoolType::SocketParams>& params, |
| 199 int num_sockets, | 194 int num_sockets, |
| 200 const BoundNetLog& net_log) { | 195 const BoundNetLog& net_log) { |
| 201 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); | 196 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); |
| 202 } | 197 } |
| 203 | 198 |
| 204 } // namespace net | 199 } // namespace net |
| 205 | 200 |
| 206 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 201 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |