OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 int active_socket_count_; // number of active sockets used by clients | 435 int active_socket_count_; // number of active sockets used by clients |
436 // A factory to pin the backup_job tasks. | 436 // A factory to pin the backup_job tasks. |
437 base::WeakPtrFactory<Group> weak_factory_; | 437 base::WeakPtrFactory<Group> weak_factory_; |
438 }; | 438 }; |
439 | 439 |
440 typedef std::map<std::string, Group*> GroupMap; | 440 typedef std::map<std::string, Group*> GroupMap; |
441 | 441 |
442 typedef std::set<ConnectJob*> ConnectJobSet; | 442 typedef std::set<ConnectJob*> ConnectJobSet; |
443 | 443 |
444 struct CallbackResultPair { | 444 struct CallbackResultPair { |
445 CallbackResultPair() : result(OK) {} | 445 CallbackResultPair(); |
446 CallbackResultPair(const CompletionCallback& callback_in, int result_in) | 446 CallbackResultPair(const CompletionCallback& callback_in, int result_in); |
447 : callback(callback_in), result(result_in) {} | |
448 ~CallbackResultPair(); | 447 ~CallbackResultPair(); |
449 | 448 |
450 CompletionCallback callback; | 449 CompletionCallback callback; |
451 int result; | 450 int result; |
452 }; | 451 }; |
453 | 452 |
454 typedef std::map<const ClientSocketHandle*, CallbackResultPair> | 453 typedef std::map<const ClientSocketHandle*, CallbackResultPair> |
455 PendingCallbackMap; | 454 PendingCallbackMap; |
456 | 455 |
457 static void InsertRequestIntoQueue(const Request* r, | 456 static void InsertRequestIntoQueue(const Request* r, |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 // Histograms for the pool | 805 // Histograms for the pool |
807 ClientSocketPoolHistograms* const histograms_; | 806 ClientSocketPoolHistograms* const histograms_; |
808 internal::ClientSocketPoolBaseHelper helper_; | 807 internal::ClientSocketPoolBaseHelper helper_; |
809 | 808 |
810 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 809 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
811 }; | 810 }; |
812 | 811 |
813 } // namespace net | 812 } // namespace net |
814 | 813 |
815 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 814 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
OLD | NEW |