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 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 // TCPConnectJob handles the host resolution necessary for socket creation | 57 // TCPConnectJob handles the host resolution necessary for socket creation |
58 // and the tcp connect. | 58 // and the tcp connect. |
59 class TCPConnectJob : public ConnectJob { | 59 class TCPConnectJob : public ConnectJob { |
60 public: | 60 public: |
61 TCPConnectJob(const std::string& group_name, | 61 TCPConnectJob(const std::string& group_name, |
62 const TCPSocketParams& params, | 62 const TCPSocketParams& params, |
63 base::TimeDelta timeout_duration, | 63 base::TimeDelta timeout_duration, |
64 ClientSocketFactory* client_socket_factory, | 64 ClientSocketFactory* client_socket_factory, |
65 HostResolver* host_resolver, | 65 HostResolver* host_resolver, |
66 Delegate* delegate, | 66 Delegate* delegate, |
67 const BoundNetLog& net_log); | 67 NetLog* net_log); |
68 virtual ~TCPConnectJob(); | 68 virtual ~TCPConnectJob(); |
69 | 69 |
70 // ConnectJob methods. | 70 // ConnectJob methods. |
71 virtual LoadState GetLoadState() const; | 71 virtual LoadState GetLoadState() const; |
72 | 72 |
73 private: | 73 private: |
74 enum State { | 74 enum State { |
75 kStateResolveHost, | 75 kStateResolveHost, |
76 kStateResolveHostComplete, | 76 kStateResolveHostComplete, |
77 kStateTCPConnect, | 77 kStateTCPConnect, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 }; | 111 }; |
112 | 112 |
113 class TCPClientSocketPool : public ClientSocketPool { | 113 class TCPClientSocketPool : public ClientSocketPool { |
114 public: | 114 public: |
115 TCPClientSocketPool( | 115 TCPClientSocketPool( |
116 int max_sockets, | 116 int max_sockets, |
117 int max_sockets_per_group, | 117 int max_sockets_per_group, |
118 const scoped_refptr<ClientSocketPoolHistograms>& histograms, | 118 const scoped_refptr<ClientSocketPoolHistograms>& histograms, |
119 HostResolver* host_resolver, | 119 HostResolver* host_resolver, |
120 ClientSocketFactory* client_socket_factory, | 120 ClientSocketFactory* client_socket_factory, |
121 NetworkChangeNotifier* network_change_notifier); | 121 NetworkChangeNotifier* network_change_notifier, |
| 122 NetLog* net_log); |
122 | 123 |
123 // ClientSocketPool methods: | 124 // ClientSocketPool methods: |
124 | 125 |
125 virtual int RequestSocket(const std::string& group_name, | 126 virtual int RequestSocket(const std::string& group_name, |
126 const void* resolve_info, | 127 const void* resolve_info, |
127 RequestPriority priority, | 128 RequestPriority priority, |
128 ClientSocketHandle* handle, | 129 ClientSocketHandle* handle, |
129 CompletionCallback* callback, | 130 CompletionCallback* callback, |
130 const BoundNetLog& net_log); | 131 const BoundNetLog& net_log); |
131 | 132 |
(...skipping 25 matching lines...) Expand all Loading... |
157 protected: | 158 protected: |
158 virtual ~TCPClientSocketPool(); | 159 virtual ~TCPClientSocketPool(); |
159 | 160 |
160 private: | 161 private: |
161 typedef ClientSocketPoolBase<TCPSocketParams> PoolBase; | 162 typedef ClientSocketPoolBase<TCPSocketParams> PoolBase; |
162 | 163 |
163 class TCPConnectJobFactory | 164 class TCPConnectJobFactory |
164 : public PoolBase::ConnectJobFactory { | 165 : public PoolBase::ConnectJobFactory { |
165 public: | 166 public: |
166 TCPConnectJobFactory(ClientSocketFactory* client_socket_factory, | 167 TCPConnectJobFactory(ClientSocketFactory* client_socket_factory, |
167 HostResolver* host_resolver) | 168 HostResolver* host_resolver, |
| 169 NetLog* net_log) |
168 : client_socket_factory_(client_socket_factory), | 170 : client_socket_factory_(client_socket_factory), |
169 host_resolver_(host_resolver) {} | 171 host_resolver_(host_resolver), |
| 172 net_log_(net_log) {} |
170 | 173 |
171 virtual ~TCPConnectJobFactory() {} | 174 virtual ~TCPConnectJobFactory() {} |
172 | 175 |
173 // ClientSocketPoolBase::ConnectJobFactory methods. | 176 // ClientSocketPoolBase::ConnectJobFactory methods. |
174 | 177 |
175 virtual ConnectJob* NewConnectJob( | 178 virtual ConnectJob* NewConnectJob( |
176 const std::string& group_name, | 179 const std::string& group_name, |
177 const PoolBase::Request& request, | 180 const PoolBase::Request& request, |
178 ConnectJob::Delegate* delegate, | 181 ConnectJob::Delegate* delegate) const; |
179 const BoundNetLog& net_log) const; | |
180 | 182 |
181 virtual base::TimeDelta ConnectionTimeout() const; | 183 virtual base::TimeDelta ConnectionTimeout() const; |
182 | 184 |
183 private: | 185 private: |
184 ClientSocketFactory* const client_socket_factory_; | 186 ClientSocketFactory* const client_socket_factory_; |
185 const scoped_refptr<HostResolver> host_resolver_; | 187 const scoped_refptr<HostResolver> host_resolver_; |
| 188 NetLog* net_log_; |
186 | 189 |
187 DISALLOW_COPY_AND_ASSIGN(TCPConnectJobFactory); | 190 DISALLOW_COPY_AND_ASSIGN(TCPConnectJobFactory); |
188 }; | 191 }; |
189 | 192 |
190 PoolBase base_; | 193 PoolBase base_; |
191 | 194 |
192 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); | 195 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketPool); |
193 }; | 196 }; |
194 | 197 |
195 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams) | 198 REGISTER_SOCKET_PARAMS_FOR_POOL(TCPClientSocketPool, TCPSocketParams) |
196 | 199 |
197 } // namespace net | 200 } // namespace net |
198 | 201 |
199 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ | 202 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_POOL_H_ |
OLD | NEW |