| 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 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 }; | 442 }; |
| 443 | 443 |
| 444 typedef std::map<std::string, Group*> GroupMap; | 444 typedef std::map<std::string, Group*> GroupMap; |
| 445 | 445 |
| 446 typedef std::set<ConnectJob*> ConnectJobSet; | 446 typedef std::set<ConnectJob*> ConnectJobSet; |
| 447 | 447 |
| 448 struct CallbackResultPair { | 448 struct CallbackResultPair { |
| 449 CallbackResultPair() : result(OK) {} | 449 CallbackResultPair() : result(OK) {} |
| 450 CallbackResultPair(const CompletionCallback& callback_in, int result_in) | 450 CallbackResultPair(const CompletionCallback& callback_in, int result_in) |
| 451 : callback(callback_in), result(result_in) {} | 451 : callback(callback_in), result(result_in) {} |
| 452 ~CallbackResultPair(); |
| 452 | 453 |
| 453 CompletionCallback callback; | 454 CompletionCallback callback; |
| 454 int result; | 455 int result; |
| 455 }; | 456 }; |
| 456 | 457 |
| 457 typedef std::map<const ClientSocketHandle*, CallbackResultPair> | 458 typedef std::map<const ClientSocketHandle*, CallbackResultPair> |
| 458 PendingCallbackMap; | 459 PendingCallbackMap; |
| 459 | 460 |
| 460 static void InsertRequestIntoQueue(const Request* r, | 461 static void InsertRequestIntoQueue(const Request* r, |
| 461 RequestQueue* pending_requests); | 462 RequestQueue* pending_requests); |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 // Histograms for the pool | 806 // Histograms for the pool |
| 806 ClientSocketPoolHistograms* const histograms_; | 807 ClientSocketPoolHistograms* const histograms_; |
| 807 internal::ClientSocketPoolBaseHelper helper_; | 808 internal::ClientSocketPoolBaseHelper helper_; |
| 808 | 809 |
| 809 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 810 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
| 810 }; | 811 }; |
| 811 | 812 |
| 812 } // namespace net | 813 } // namespace net |
| 813 | 814 |
| 814 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 815 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| OLD | NEW |