| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 }; | 349 }; |
| 350 | 350 |
| 351 typedef std::map<const ClientSocketHandle*, CallbackResultPair> | 351 typedef std::map<const ClientSocketHandle*, CallbackResultPair> |
| 352 PendingCallbackMap; | 352 PendingCallbackMap; |
| 353 | 353 |
| 354 ~ClientSocketPoolBaseHelper(); | 354 ~ClientSocketPoolBaseHelper(); |
| 355 | 355 |
| 356 static void InsertRequestIntoQueue(const Request* r, | 356 static void InsertRequestIntoQueue(const Request* r, |
| 357 RequestQueue* pending_requests); | 357 RequestQueue* pending_requests); |
| 358 static const Request* RemoveRequestFromQueue(RequestQueue::iterator it, | 358 static const Request* RemoveRequestFromQueue(RequestQueue::iterator it, |
| 359 RequestQueue* pending_requests); | 359 Group* group); |
| 360 | 360 |
| 361 Group* GetOrCreateGroup(const std::string& group_name); | 361 Group* GetOrCreateGroup(const std::string& group_name); |
| 362 void RemoveGroup(const std::string& group_name); | 362 void RemoveGroup(const std::string& group_name); |
| 363 void RemoveGroup(GroupMap::iterator it); | 363 void RemoveGroup(GroupMap::iterator it); |
| 364 | 364 |
| 365 // Called when the number of idle sockets changes. | 365 // Called when the number of idle sockets changes. |
| 366 void IncrementIdleCount(); | 366 void IncrementIdleCount(); |
| 367 void DecrementIdleCount(); | 367 void DecrementIdleCount(); |
| 368 | 368 |
| 369 // Scans the group map for groups which have an available socket slot and | 369 // Scans the group map for groups which have an available socket slot and |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 // ClientSocketPoolBase<T> reference to drop to zero. While we're deep | 661 // ClientSocketPoolBase<T> reference to drop to zero. While we're deep |
| 662 // in cleanup code, we'll often hold a reference to |self|. | 662 // in cleanup code, we'll often hold a reference to |self|. |
| 663 scoped_refptr<internal::ClientSocketPoolBaseHelper> helper_; | 663 scoped_refptr<internal::ClientSocketPoolBaseHelper> helper_; |
| 664 | 664 |
| 665 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 665 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
| 666 }; | 666 }; |
| 667 | 667 |
| 668 } // namespace net | 668 } // namespace net |
| 669 | 669 |
| 670 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 670 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| OLD | NEW |