| 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 #ifndef NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 5 #ifndef NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
| 6 #define NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 6 #define NET_HTTP_HTTP_PROXY_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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 public: | 104 public: |
| 105 HttpProxyConnectJob(const std::string& group_name, | 105 HttpProxyConnectJob(const std::string& group_name, |
| 106 RequestPriority priority, | 106 RequestPriority priority, |
| 107 const scoped_refptr<HttpProxySocketParams>& params, | 107 const scoped_refptr<HttpProxySocketParams>& params, |
| 108 const base::TimeDelta& timeout_duration, | 108 const base::TimeDelta& timeout_duration, |
| 109 TransportClientSocketPool* transport_pool, | 109 TransportClientSocketPool* transport_pool, |
| 110 SSLClientSocketPool* ssl_pool, | 110 SSLClientSocketPool* ssl_pool, |
| 111 HostResolver* host_resolver, | 111 HostResolver* host_resolver, |
| 112 Delegate* delegate, | 112 Delegate* delegate, |
| 113 NetLog* net_log); | 113 NetLog* net_log); |
| 114 virtual ~HttpProxyConnectJob(); | 114 ~HttpProxyConnectJob() override; |
| 115 | 115 |
| 116 // ConnectJob methods. | 116 // ConnectJob methods. |
| 117 virtual LoadState GetLoadState() const override; | 117 LoadState GetLoadState() const override; |
| 118 | 118 |
| 119 virtual void GetAdditionalErrorState(ClientSocketHandle* handle) override; | 119 void GetAdditionalErrorState(ClientSocketHandle* handle) override; |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 enum State { | 122 enum State { |
| 123 STATE_TCP_CONNECT, | 123 STATE_TCP_CONNECT, |
| 124 STATE_TCP_CONNECT_COMPLETE, | 124 STATE_TCP_CONNECT_COMPLETE, |
| 125 STATE_SSL_CONNECT, | 125 STATE_SSL_CONNECT, |
| 126 STATE_SSL_CONNECT_COMPLETE, | 126 STATE_SSL_CONNECT_COMPLETE, |
| 127 STATE_HTTP_PROXY_CONNECT, | 127 STATE_HTTP_PROXY_CONNECT, |
| 128 STATE_HTTP_PROXY_CONNECT_COMPLETE, | 128 STATE_HTTP_PROXY_CONNECT_COMPLETE, |
| 129 STATE_SPDY_PROXY_CREATE_STREAM, | 129 STATE_SPDY_PROXY_CREATE_STREAM, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 150 int DoSpdyProxyCreateStream(); | 150 int DoSpdyProxyCreateStream(); |
| 151 int DoSpdyProxyCreateStreamComplete(int result); | 151 int DoSpdyProxyCreateStreamComplete(int result); |
| 152 | 152 |
| 153 // Begins the tcp connection and the optional Http proxy tunnel. If the | 153 // Begins the tcp connection and the optional Http proxy tunnel. If the |
| 154 // request is not immediately servicable (likely), the request will return | 154 // request is not immediately servicable (likely), the request will return |
| 155 // ERR_IO_PENDING. An OK return from this function or the callback means | 155 // ERR_IO_PENDING. An OK return from this function or the callback means |
| 156 // that the connection is established; ERR_PROXY_AUTH_REQUESTED means | 156 // that the connection is established; ERR_PROXY_AUTH_REQUESTED means |
| 157 // that the tunnel needs authentication credentials, the socket will be | 157 // that the tunnel needs authentication credentials, the socket will be |
| 158 // returned in this case, and must be release back to the pool; or | 158 // returned in this case, and must be release back to the pool; or |
| 159 // a standard net error code will be returned. | 159 // a standard net error code will be returned. |
| 160 virtual int ConnectInternal() override; | 160 int ConnectInternal() override; |
| 161 | 161 |
| 162 scoped_refptr<HttpProxySocketParams> params_; | 162 scoped_refptr<HttpProxySocketParams> params_; |
| 163 TransportClientSocketPool* const transport_pool_; | 163 TransportClientSocketPool* const transport_pool_; |
| 164 SSLClientSocketPool* const ssl_pool_; | 164 SSLClientSocketPool* const ssl_pool_; |
| 165 HostResolver* const resolver_; | 165 HostResolver* const resolver_; |
| 166 | 166 |
| 167 State next_state_; | 167 State next_state_; |
| 168 CompletionCallback callback_; | 168 CompletionCallback callback_; |
| 169 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 169 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
| 170 scoped_ptr<ProxyClientSocket> transport_socket_; | 170 scoped_ptr<ProxyClientSocket> transport_socket_; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 190 HttpProxyClientSocketPool( | 190 HttpProxyClientSocketPool( |
| 191 int max_sockets, | 191 int max_sockets, |
| 192 int max_sockets_per_group, | 192 int max_sockets_per_group, |
| 193 ClientSocketPoolHistograms* histograms, | 193 ClientSocketPoolHistograms* histograms, |
| 194 HostResolver* host_resolver, | 194 HostResolver* host_resolver, |
| 195 TransportClientSocketPool* transport_pool, | 195 TransportClientSocketPool* transport_pool, |
| 196 SSLClientSocketPool* ssl_pool, | 196 SSLClientSocketPool* ssl_pool, |
| 197 const ProxyDelegate* proxy_delegate, | 197 const ProxyDelegate* proxy_delegate, |
| 198 NetLog* net_log); | 198 NetLog* net_log); |
| 199 | 199 |
| 200 virtual ~HttpProxyClientSocketPool(); | 200 ~HttpProxyClientSocketPool() override; |
| 201 | 201 |
| 202 // ClientSocketPool implementation. | 202 // ClientSocketPool implementation. |
| 203 virtual int RequestSocket(const std::string& group_name, | 203 int RequestSocket(const std::string& group_name, |
| 204 const void* connect_params, | 204 const void* connect_params, |
| 205 RequestPriority priority, | 205 RequestPriority priority, |
| 206 ClientSocketHandle* handle, | 206 ClientSocketHandle* handle, |
| 207 const CompletionCallback& callback, | 207 const CompletionCallback& callback, |
| 208 const BoundNetLog& net_log) override; | 208 const BoundNetLog& net_log) override; |
| 209 | 209 |
| 210 virtual void RequestSockets(const std::string& group_name, | 210 void RequestSockets(const std::string& group_name, |
| 211 const void* params, | 211 const void* params, |
| 212 int num_sockets, | 212 int num_sockets, |
| 213 const BoundNetLog& net_log) override; | 213 const BoundNetLog& net_log) override; |
| 214 | 214 |
| 215 virtual void CancelRequest(const std::string& group_name, | 215 void CancelRequest(const std::string& group_name, |
| 216 ClientSocketHandle* handle) override; | 216 ClientSocketHandle* handle) override; |
| 217 | 217 |
| 218 virtual void ReleaseSocket(const std::string& group_name, | 218 void ReleaseSocket(const std::string& group_name, |
| 219 scoped_ptr<StreamSocket> socket, | 219 scoped_ptr<StreamSocket> socket, |
| 220 int id) override; | 220 int id) override; |
| 221 | 221 |
| 222 virtual void FlushWithError(int error) override; | 222 void FlushWithError(int error) override; |
| 223 | 223 |
| 224 virtual void CloseIdleSockets() override; | 224 void CloseIdleSockets() override; |
| 225 | 225 |
| 226 virtual int IdleSocketCount() const override; | 226 int IdleSocketCount() const override; |
| 227 | 227 |
| 228 virtual int IdleSocketCountInGroup( | 228 int IdleSocketCountInGroup(const std::string& group_name) const override; |
| 229 const std::string& group_name) const override; | |
| 230 | 229 |
| 231 virtual LoadState GetLoadState( | 230 LoadState GetLoadState(const std::string& group_name, |
| 232 const std::string& group_name, | 231 const ClientSocketHandle* handle) const override; |
| 233 const ClientSocketHandle* handle) const override; | |
| 234 | 232 |
| 235 virtual base::DictionaryValue* GetInfoAsValue( | 233 base::DictionaryValue* GetInfoAsValue( |
| 236 const std::string& name, | 234 const std::string& name, |
| 237 const std::string& type, | 235 const std::string& type, |
| 238 bool include_nested_pools) const override; | 236 bool include_nested_pools) const override; |
| 239 | 237 |
| 240 virtual base::TimeDelta ConnectionTimeout() const override; | 238 base::TimeDelta ConnectionTimeout() const override; |
| 241 | 239 |
| 242 virtual ClientSocketPoolHistograms* histograms() const override; | 240 ClientSocketPoolHistograms* histograms() const override; |
| 243 | 241 |
| 244 // LowerLayeredPool implementation. | 242 // LowerLayeredPool implementation. |
| 245 virtual bool IsStalled() const override; | 243 bool IsStalled() const override; |
| 246 | 244 |
| 247 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; | 245 void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
| 248 | 246 |
| 249 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; | 247 void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
| 250 | 248 |
| 251 // HigherLayeredPool implementation. | 249 // HigherLayeredPool implementation. |
| 252 virtual bool CloseOneIdleConnection() override; | 250 bool CloseOneIdleConnection() override; |
| 253 | 251 |
| 254 private: | 252 private: |
| 255 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; | 253 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; |
| 256 | 254 |
| 257 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { | 255 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { |
| 258 public: | 256 public: |
| 259 HttpProxyConnectJobFactory( | 257 HttpProxyConnectJobFactory( |
| 260 TransportClientSocketPool* transport_pool, | 258 TransportClientSocketPool* transport_pool, |
| 261 SSLClientSocketPool* ssl_pool, | 259 SSLClientSocketPool* ssl_pool, |
| 262 HostResolver* host_resolver, | 260 HostResolver* host_resolver, |
| 263 const ProxyDelegate* proxy_delegate, | 261 const ProxyDelegate* proxy_delegate, |
| 264 NetLog* net_log); | 262 NetLog* net_log); |
| 265 | 263 |
| 266 // ClientSocketPoolBase::ConnectJobFactory methods. | 264 // ClientSocketPoolBase::ConnectJobFactory methods. |
| 267 virtual scoped_ptr<ConnectJob> NewConnectJob( | 265 scoped_ptr<ConnectJob> NewConnectJob( |
| 268 const std::string& group_name, | 266 const std::string& group_name, |
| 269 const PoolBase::Request& request, | 267 const PoolBase::Request& request, |
| 270 ConnectJob::Delegate* delegate) const override; | 268 ConnectJob::Delegate* delegate) const override; |
| 271 | 269 |
| 272 virtual base::TimeDelta ConnectionTimeout() const override; | 270 base::TimeDelta ConnectionTimeout() const override; |
| 273 | 271 |
| 274 private: | 272 private: |
| 275 TransportClientSocketPool* const transport_pool_; | 273 TransportClientSocketPool* const transport_pool_; |
| 276 SSLClientSocketPool* const ssl_pool_; | 274 SSLClientSocketPool* const ssl_pool_; |
| 277 HostResolver* const host_resolver_; | 275 HostResolver* const host_resolver_; |
| 278 const ProxyDelegate* proxy_delegate_; | 276 const ProxyDelegate* proxy_delegate_; |
| 279 NetLog* net_log_; | 277 NetLog* net_log_; |
| 280 base::TimeDelta timeout_; | 278 base::TimeDelta timeout_; |
| 281 | 279 |
| 282 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); | 280 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); |
| 283 }; | 281 }; |
| 284 | 282 |
| 285 TransportClientSocketPool* const transport_pool_; | 283 TransportClientSocketPool* const transport_pool_; |
| 286 SSLClientSocketPool* const ssl_pool_; | 284 SSLClientSocketPool* const ssl_pool_; |
| 287 PoolBase base_; | 285 PoolBase base_; |
| 288 | 286 |
| 289 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); | 287 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); |
| 290 }; | 288 }; |
| 291 | 289 |
| 292 } // namespace net | 290 } // namespace net |
| 293 | 291 |
| 294 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 292 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |