| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/time.h" | 14 #include "base/time.h" |
| 15 #include "base/template_util.h" | 15 #include "base/template_util.h" |
| 16 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
| 17 #include "net/base/host_resolver.h" | 17 #include "net/base/host_resolver.h" |
| 18 #include "net/base/load_states.h" | 18 #include "net/base/load_states.h" |
| 19 #include "net/base/net_api.h" | 19 #include "net/base/net_api.h" |
| 20 #include "net/base/request_priority.h" | 20 #include "net/base/request_priority.h" |
| 21 | 21 |
| 22 namespace base { |
| 22 class DictionaryValue; | 23 class DictionaryValue; |
| 24 } |
| 23 | 25 |
| 24 namespace net { | 26 namespace net { |
| 25 | 27 |
| 26 class ClientSocketHandle; | 28 class ClientSocketHandle; |
| 27 class ClientSocketPoolHistograms; | 29 class ClientSocketPoolHistograms; |
| 28 class StreamSocket; | 30 class StreamSocket; |
| 29 | 31 |
| 30 // A ClientSocketPool is used to restrict the number of sockets open at a time. | 32 // A ClientSocketPool is used to restrict the number of sockets open at a time. |
| 31 // It also maintains a list of idle persistent sockets. | 33 // It also maintains a list of idle persistent sockets. |
| 32 // | 34 // |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 virtual int IdleSocketCountInGroup(const std::string& group_name) const = 0; | 120 virtual int IdleSocketCountInGroup(const std::string& group_name) const = 0; |
| 119 | 121 |
| 120 // Determine the LoadState of a connecting ClientSocketHandle. | 122 // Determine the LoadState of a connecting ClientSocketHandle. |
| 121 virtual LoadState GetLoadState(const std::string& group_name, | 123 virtual LoadState GetLoadState(const std::string& group_name, |
| 122 const ClientSocketHandle* handle) const = 0; | 124 const ClientSocketHandle* handle) const = 0; |
| 123 | 125 |
| 124 // Retrieves information on the current state of the pool as a | 126 // Retrieves information on the current state of the pool as a |
| 125 // DictionaryValue. Caller takes possession of the returned value. | 127 // DictionaryValue. Caller takes possession of the returned value. |
| 126 // If |include_nested_pools| is true, the states of any nested | 128 // If |include_nested_pools| is true, the states of any nested |
| 127 // ClientSocketPools will be included. | 129 // ClientSocketPools will be included. |
| 128 virtual DictionaryValue* GetInfoAsValue(const std::string& name, | 130 virtual base::DictionaryValue* GetInfoAsValue( |
| 129 const std::string& type, | 131 const std::string& name, |
| 130 bool include_nested_pools) const = 0; | 132 const std::string& type, |
| 133 bool include_nested_pools) const = 0; |
| 131 | 134 |
| 132 // Returns the maximum amount of time to wait before retrying a connect. | 135 // Returns the maximum amount of time to wait before retrying a connect. |
| 133 static const int kMaxConnectRetryIntervalMs = 250; | 136 static const int kMaxConnectRetryIntervalMs = 250; |
| 134 | 137 |
| 135 // The set of histograms specific to this pool. We can't use the standard | 138 // The set of histograms specific to this pool. We can't use the standard |
| 136 // UMA_HISTOGRAM_* macros because they are callsite static. | 139 // UMA_HISTOGRAM_* macros because they are callsite static. |
| 137 virtual ClientSocketPoolHistograms* histograms() const = 0; | 140 virtual ClientSocketPoolHistograms* histograms() const = 0; |
| 138 | 141 |
| 139 static int unused_idle_socket_timeout(); | 142 static int unused_idle_socket_timeout(); |
| 140 static void set_unused_idle_socket_timeout(int timeout); | 143 static void set_unused_idle_socket_timeout(int timeout); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 const scoped_refptr<SocketParams>& params, | 187 const scoped_refptr<SocketParams>& params, |
| 185 int num_sockets, | 188 int num_sockets, |
| 186 const BoundNetLog& net_log) { | 189 const BoundNetLog& net_log) { |
| 187 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); | 190 CheckIsValidSocketParamsForPool<PoolType, SocketParams>(); |
| 188 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); | 191 pool->RequestSockets(group_name, ¶ms, num_sockets, net_log); |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace net | 194 } // namespace net |
| 192 | 195 |
| 193 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ | 196 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |