OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Alerts the delegate that the ConnectJob has timed out. | 102 // Alerts the delegate that the ConnectJob has timed out. |
103 void OnTimeout(); | 103 void OnTimeout(); |
104 | 104 |
105 const std::string group_name_; | 105 const std::string group_name_; |
106 const base::TimeDelta timeout_duration_; | 106 const base::TimeDelta timeout_duration_; |
107 // Timer to abort jobs that take too long. | 107 // Timer to abort jobs that take too long. |
108 base::OneShotTimer<ConnectJob> timer_; | 108 base::OneShotTimer<ConnectJob> timer_; |
109 Delegate* delegate_; | 109 Delegate* delegate_; |
110 scoped_ptr<ClientSocket> socket_; | 110 scoped_ptr<ClientSocket> socket_; |
111 BoundNetLog net_log_; | 111 BoundNetLog net_log_; |
| 112 // A ConnectJob is idle until Connect() has been called. |
| 113 bool idle_; |
112 | 114 |
113 DISALLOW_COPY_AND_ASSIGN(ConnectJob); | 115 DISALLOW_COPY_AND_ASSIGN(ConnectJob); |
114 }; | 116 }; |
115 | 117 |
116 namespace internal { | 118 namespace internal { |
117 | 119 |
118 // ClientSocketPoolBaseHelper is an internal class that implements almost all | 120 // ClientSocketPoolBaseHelper is an internal class that implements almost all |
119 // the functionality from ClientSocketPoolBase without using templates. | 121 // the functionality from ClientSocketPoolBase without using templates. |
120 // ClientSocketPoolBase adds templated definitions built on top of | 122 // ClientSocketPoolBase adds templated definitions built on top of |
121 // ClientSocketPoolBaseHelper. This class is not for external use, please use | 123 // ClientSocketPoolBaseHelper. This class is not for external use, please use |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 // the posting of the task and the execution, then we'll hit the DCHECK that | 624 // the posting of the task and the execution, then we'll hit the DCHECK that |
623 // |ClientSocketPoolBaseHelper::group_map_| is empty. | 625 // |ClientSocketPoolBaseHelper::group_map_| is empty. |
624 scoped_refptr<internal::ClientSocketPoolBaseHelper> helper_; | 626 scoped_refptr<internal::ClientSocketPoolBaseHelper> helper_; |
625 | 627 |
626 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); | 628 DISALLOW_COPY_AND_ASSIGN(ClientSocketPoolBase); |
627 }; | 629 }; |
628 | 630 |
629 } // namespace net | 631 } // namespace net |
630 | 632 |
631 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ | 633 #endif // NET_SOCKET_CLIENT_SOCKET_POOL_BASE_H_ |
OLD | NEW |