| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 base::TimeDelta ConnectionTimeout() const { | 304 base::TimeDelta ConnectionTimeout() const { |
| 305 return connect_job_factory_->ConnectionTimeout(); | 305 return connect_job_factory_->ConnectionTimeout(); |
| 306 } | 306 } |
| 307 | 307 |
| 308 static bool connect_backup_jobs_enabled(); | 308 static bool connect_backup_jobs_enabled(); |
| 309 static bool set_connect_backup_jobs_enabled(bool enabled); | 309 static bool set_connect_backup_jobs_enabled(bool enabled); |
| 310 | 310 |
| 311 void EnableConnectBackupJobs(); | 311 void EnableConnectBackupJobs(); |
| 312 | 312 |
| 313 // ConnectJob::Delegate methods: | 313 // ConnectJob::Delegate methods: |
| 314 virtual void OnConnectJobComplete(int result, ConnectJob* job); | 314 virtual void OnConnectJobComplete(int result, ConnectJob* job) OVERRIDE; |
| 315 | 315 |
| 316 // NetworkChangeNotifier::IPAddressObserver methods: | 316 // NetworkChangeNotifier::IPAddressObserver methods: |
| 317 virtual void OnIPAddressChanged(); | 317 virtual void OnIPAddressChanged() OVERRIDE; |
| 318 | 318 |
| 319 private: | 319 private: |
| 320 friend class base::RefCounted<ClientSocketPoolBaseHelper>; | 320 friend class base::RefCounted<ClientSocketPoolBaseHelper>; |
| 321 | 321 |
| 322 // Entry for a persistent socket which became idle at time |start_time|. | 322 // Entry for a persistent socket which became idle at time |start_time|. |
| 323 struct IdleSocket { | 323 struct IdleSocket { |
| 324 IdleSocket() : socket(NULL) {} | 324 IdleSocket() : socket(NULL) {} |
| 325 | 325 |
| 326 // An idle socket should be removed if it can't be reused, or has been idle | 326 // An idle socket should be removed if it can't be reused, or has been idle |
| 327 // for too long. |now| is the current time value (TimeTicks::Now()). | 327 // for too long. |now| is the current time value (TimeTicks::Now()). |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 // Histograms for the pool | 761 // Histograms for the pool |
| 762 ClientSocketPoolHistograms* const histograms_; | 762 ClientSocketPoolHistograms* const histograms_; |
| 763 internal::ClientSocketPoolBaseHelper helper_; | 763 internal::ClientSocketPoolBaseHelper helper_; |
| 764 | 764 |
| 765 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 765 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
| 766 }; | 766 }; |
| 767 | 767 |
| 768 } // namespace net | 768 } // namespace net |
| 769 | 769 |
| 770 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 770 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
| OLD | NEW |