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 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
319 // TODO(willchan): Consider a better algorithm for doing this. Perhaps we | 319 // TODO(willchan): Consider a better algorithm for doing this. Perhaps we |
320 // should keep an ordered list of idle sockets, and close them in order. | 320 // should keep an ordered list of idle sockets, and close them in order. |
321 // Requires maintaining more state. It's not clear if it's worth it since | 321 // Requires maintaining more state. It's not clear if it's worth it since |
322 // I'm not sure if we hit this situation often. | 322 // I'm not sure if we hit this situation often. |
323 bool CloseOneIdleSocket(); | 323 bool CloseOneIdleSocket(); |
324 | 324 |
325 // Checks higher layered pools to see if they can close an idle connection. | 325 // Checks higher layered pools to see if they can close an idle connection. |
326 bool CloseOneIdleConnectionInHigherLayeredPool(); | 326 bool CloseOneIdleConnectionInHigherLayeredPool(); |
327 | 327 |
328 // See ClientSocketPool::GetInfoAsValue for documentation on this function. | 328 // See ClientSocketPool::GetInfoAsValue for documentation on this function. |
329 base::DictionaryValue* GetInfoAsValue(const std::string& name, | 329 scoped_ptr<base::DictionaryValue> GetInfoAsValue(const std::string& name, |
330 const std::string& type) const; | 330 const std::string& type) const; |
eroman
2015/06/01 17:07:23
Have you re-run "git cl format" ?
| |
331 | 331 |
332 base::TimeDelta ConnectionTimeout() const { | 332 base::TimeDelta ConnectionTimeout() const { |
333 return connect_job_factory_->ConnectionTimeout(); | 333 return connect_job_factory_->ConnectionTimeout(); |
334 } | 334 } |
335 | 335 |
336 static bool connect_backup_jobs_enabled(); | 336 static bool connect_backup_jobs_enabled(); |
337 static bool set_connect_backup_jobs_enabled(bool enabled); | 337 static bool set_connect_backup_jobs_enabled(bool enabled); |
338 | 338 |
339 void EnableConnectBackupJobs(); | 339 void EnableConnectBackupJobs(); |
340 | 340 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
820 } | 820 } |
821 | 821 |
822 bool HasGroup(const std::string& group_name) const { | 822 bool HasGroup(const std::string& group_name) const { |
823 return helper_.HasGroup(group_name); | 823 return helper_.HasGroup(group_name); |
824 } | 824 } |
825 | 825 |
826 void CleanupIdleSockets(bool force) { | 826 void CleanupIdleSockets(bool force) { |
827 return helper_.CleanupIdleSockets(force); | 827 return helper_.CleanupIdleSockets(force); |
828 } | 828 } |
829 | 829 |
830 base::DictionaryValue* GetInfoAsValue(const std::string& name, | 830 scoped_ptr<base::DictionaryValue> GetInfoAsValue(const std::string& name, |
831 const std::string& type) const { | 831 const std::string& type) const { |
832 return helper_.GetInfoAsValue(name, type); | 832 return helper_.GetInfoAsValue(name, type).Pass(); |
eroman
2015/06/01 17:07:23
Pass() is unnecessary
| |
833 } | 833 } |
834 | 834 |
835 base::TimeDelta ConnectionTimeout() const { | 835 base::TimeDelta ConnectionTimeout() const { |
836 return helper_.ConnectionTimeout(); | 836 return helper_.ConnectionTimeout(); |
837 } | 837 } |
838 | 838 |
839 void EnableConnectBackupJobs() { helper_.EnableConnectBackupJobs(); } | 839 void EnableConnectBackupJobs() { helper_.EnableConnectBackupJobs(); } |
840 | 840 |
841 bool CloseOneIdleSocket() { return helper_.CloseOneIdleSocket(); } | 841 bool CloseOneIdleSocket() { return helper_.CloseOneIdleSocket(); } |
842 | 842 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
877 }; | 877 }; |
878 | 878 |
879 internal::ClientSocketPoolBaseHelper helper_; | 879 internal::ClientSocketPoolBaseHelper helper_; |
880 | 880 |
881 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 881 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
882 }; | 882 }; |
883 | 883 |
884 } // namespace net | 884 } // namespace net |
885 | 885 |
886 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 886 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
OLD | NEW |