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 // A ClientSocketPoolBase is used to restrict the number of sockets open at | 5 // A ClientSocketPoolBase is used to restrict the number of sockets open at |
6 // a time. It also maintains a list of idle persistent sockets for reuse. | 6 // a time. It also maintains a list of idle persistent sockets for reuse. |
7 // Subclasses of ClientSocketPool should compose ClientSocketPoolBase to handle | 7 // Subclasses of ClientSocketPool should compose ClientSocketPoolBase to handle |
8 // the core logic of (1) restricting the number of active (connected or | 8 // the core logic of (1) restricting the number of active (connected or |
9 // connecting) sockets per "group" (generally speaking, the hostname), (2) | 9 // connecting) sockets per "group" (generally speaking, the hostname), (2) |
10 // maintaining a per-group list of idle, persistent sockets for reuse, and (3) | 10 // maintaining a per-group list of idle, persistent sockets for reuse, and (3) |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory); | 212 DISALLOW_COPY_AND_ASSIGN(ConnectJobFactory); |
213 }; | 213 }; |
214 | 214 |
215 ClientSocketPoolBaseHelper( | 215 ClientSocketPoolBaseHelper( |
216 int max_sockets, | 216 int max_sockets, |
217 int max_sockets_per_group, | 217 int max_sockets_per_group, |
218 base::TimeDelta unused_idle_socket_timeout, | 218 base::TimeDelta unused_idle_socket_timeout, |
219 base::TimeDelta used_idle_socket_timeout, | 219 base::TimeDelta used_idle_socket_timeout, |
220 ConnectJobFactory* connect_job_factory); | 220 ConnectJobFactory* connect_job_factory); |
221 | 221 |
222 ~ClientSocketPoolBaseHelper(); | 222 virtual ~ClientSocketPoolBaseHelper(); |
223 | 223 |
224 // See ClientSocketPool::RequestSocket for documentation on this function. | 224 // See ClientSocketPool::RequestSocket for documentation on this function. |
225 // ClientSocketPoolBaseHelper takes ownership of |request|, which must be | 225 // ClientSocketPoolBaseHelper takes ownership of |request|, which must be |
226 // heap allocated. | 226 // heap allocated. |
227 int RequestSocket(const std::string& group_name, const Request* request); | 227 int RequestSocket(const std::string& group_name, const Request* request); |
228 | 228 |
229 // See ClientSocketPool::RequestSocket for documentation on this function. | 229 // See ClientSocketPool::RequestSocket for documentation on this function. |
230 void RequestSockets(const std::string& group_name, | 230 void RequestSockets(const std::string& group_name, |
231 const Request& request, | 231 const Request& request, |
232 int num_sockets); | 232 int num_sockets); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 // Histograms for the pool | 746 // Histograms for the pool |
747 ClientSocketPoolHistograms* const histograms_; | 747 ClientSocketPoolHistograms* const histograms_; |
748 internal::ClientSocketPoolBaseHelper helper_; | 748 internal::ClientSocketPoolBaseHelper helper_; |
749 | 749 |
750 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 750 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
751 }; | 751 }; |
752 | 752 |
753 } // namespace net | 753 } // namespace net |
754 | 754 |
755 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 755 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
OLD | NEW |