| 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_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 5 #ifndef NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 6 #define NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 typedef std::deque<Request> RequestQueue; | 190 typedef std::deque<Request> RequestQueue; |
| 191 typedef std::map<const ClientSocketHandle*, Request> RequestMap; | 191 typedef std::map<const ClientSocketHandle*, Request> RequestMap; |
| 192 | 192 |
| 193 // A Group is allocated per group_name when there are idle sockets or pending | 193 // A Group is allocated per group_name when there are idle sockets or pending |
| 194 // requests. Otherwise, the Group object is removed from the map. | 194 // requests. Otherwise, the Group object is removed from the map. |
| 195 struct Group { | 195 struct Group { |
| 196 Group() : active_socket_count(0) {} | 196 Group() : active_socket_count(0) {} |
| 197 | 197 |
| 198 bool IsEmpty() const { | 198 bool IsEmpty() const { |
| 199 return active_socket_count == 0 && idle_sockets.empty() && jobs.empty() && | 199 return active_socket_count == 0 && idle_sockets.empty() && jobs.empty(); |
| 200 pending_requests.empty() && connecting_requests.empty(); | |
| 201 } | 200 } |
| 202 | 201 |
| 203 bool HasAvailableSocketSlot(int max_sockets_per_group) const { | 202 bool HasAvailableSocketSlot(int max_sockets_per_group) const { |
| 204 return active_socket_count + static_cast<int>(jobs.size()) < | 203 return active_socket_count + static_cast<int>(jobs.size()) < |
| 205 max_sockets_per_group; | 204 max_sockets_per_group; |
| 206 } | 205 } |
| 207 | 206 |
| 208 std::deque<IdleSocket> idle_sockets; | 207 std::deque<IdleSocket> idle_sockets; |
| 209 std::set<const ConnectJob*> jobs; | 208 std::set<const ConnectJob*> jobs; |
| 210 RequestQueue pending_requests; | 209 RequestQueue pending_requests; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 | 287 |
| 289 // Controls whether or not we use late binding of sockets. | 288 // Controls whether or not we use late binding of sockets. |
| 290 static bool g_late_binding; | 289 static bool g_late_binding; |
| 291 | 290 |
| 292 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 291 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
| 293 }; | 292 }; |
| 294 | 293 |
| 295 } // namespace net | 294 } // namespace net |
| 296 | 295 |
| 297 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 296 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| OLD | NEW |