OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_BASE_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_BASE_CLIENT_SOCKET_POOL_H_ |
6 #define NET_BASE_CLIENT_SOCKET_POOL_H_ | 6 #define NET_BASE_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 void ReleaseSocket(ClientSocketHandle* handle); | 66 void ReleaseSocket(ClientSocketHandle* handle); |
67 | 67 |
68 // Called to close any idle connections held by the connection manager. | 68 // Called to close any idle connections held by the connection manager. |
69 void CloseIdleSockets(); | 69 void CloseIdleSockets(); |
70 | 70 |
71 // The total number of idle sockets in the pool. | 71 // The total number of idle sockets in the pool. |
72 int idle_socket_count() const { | 72 int idle_socket_count() const { |
73 return idle_socket_count_; | 73 return idle_socket_count_; |
74 } | 74 } |
75 | 75 |
| 76 // The total number of idle sockets in a connection group. |
| 77 int IdleSocketCountInGroup(const std::string& group_name) const; |
| 78 |
76 private: | 79 private: |
77 friend class base::RefCounted<ClientSocketPool>; | 80 friend class base::RefCounted<ClientSocketPool>; |
78 | 81 |
79 typedef scoped_ptr<ClientSocket> ClientSocketPtr; | 82 typedef scoped_ptr<ClientSocket> ClientSocketPtr; |
80 | 83 |
81 // A Request is allocated per call to RequestSocket that results in | 84 // A Request is allocated per call to RequestSocket that results in |
82 // ERR_IO_PENDING. | 85 // ERR_IO_PENDING. |
83 struct Request { | 86 struct Request { |
84 ClientSocketHandle* handle; | 87 ClientSocketHandle* handle; |
85 CompletionCallback* callback; | 88 CompletionCallback* callback; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 150 |
148 // The maximum number of sockets kept per group. | 151 // The maximum number of sockets kept per group. |
149 int max_sockets_per_group_; | 152 int max_sockets_per_group_; |
150 | 153 |
151 DISALLOW_COPY_AND_ASSIGN(ClientSocketPool); | 154 DISALLOW_COPY_AND_ASSIGN(ClientSocketPool); |
152 }; | 155 }; |
153 | 156 |
154 } // namespace net | 157 } // namespace net |
155 | 158 |
156 #endif // NET_BASE_CLIENT_SOCKET_POOL_H_ | 159 #endif // NET_BASE_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |