| 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 852 | 852 |
| 853 virtual scoped_ptr<ConnectJob> NewConnectJob( | 853 virtual scoped_ptr<ConnectJob> NewConnectJob( |
| 854 const std::string& group_name, | 854 const std::string& group_name, |
| 855 const internal::ClientSocketPoolBaseHelper::Request& request, | 855 const internal::ClientSocketPoolBaseHelper::Request& request, |
| 856 ConnectJob::Delegate* delegate) const override { | 856 ConnectJob::Delegate* delegate) const override { |
| 857 const Request& casted_request = static_cast<const Request&>(request); | 857 const Request& casted_request = static_cast<const Request&>(request); |
| 858 return connect_job_factory_->NewConnectJob( | 858 return connect_job_factory_->NewConnectJob( |
| 859 group_name, casted_request, delegate); | 859 group_name, casted_request, delegate); |
| 860 } | 860 } |
| 861 | 861 |
| 862 virtual base::TimeDelta ConnectionTimeout() const { | 862 base::TimeDelta ConnectionTimeout() const override { |
| 863 return connect_job_factory_->ConnectionTimeout(); | 863 return connect_job_factory_->ConnectionTimeout(); |
| 864 } | 864 } |
| 865 | 865 |
| 866 const scoped_ptr<ConnectJobFactory> connect_job_factory_; | 866 const scoped_ptr<ConnectJobFactory> connect_job_factory_; |
| 867 }; | 867 }; |
| 868 | 868 |
| 869 // Histograms for the pool | 869 // Histograms for the pool |
| 870 ClientSocketPoolHistograms* const histograms_; | 870 ClientSocketPoolHistograms* const histograms_; |
| 871 internal::ClientSocketPoolBaseHelper helper_; | 871 internal::ClientSocketPoolBaseHelper helper_; |
| 872 | 872 |
| 873 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 873 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
| 874 }; | 874 }; |
| 875 | 875 |
| 876 } // namespace net | 876 } // namespace net |
| 877 | 877 |
| 878 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 878 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| OLD | NEW |