| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~HttpProxyConnectJob(); |
| 115 | 115 |
| 116 // ConnectJob methods. | 116 // ConnectJob methods. |
| 117 virtual LoadState GetLoadState() const OVERRIDE; | 117 virtual LoadState GetLoadState() const override; |
| 118 | 118 |
| 119 virtual void GetAdditionalErrorState(ClientSocketHandle* handle) OVERRIDE; | 119 virtual 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 virtual 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 27 matching lines...) Expand all Loading... |
| 198 NetLog* net_log); | 198 NetLog* net_log); |
| 199 | 199 |
| 200 virtual ~HttpProxyClientSocketPool(); | 200 virtual ~HttpProxyClientSocketPool(); |
| 201 | 201 |
| 202 // ClientSocketPool implementation. | 202 // ClientSocketPool implementation. |
| 203 virtual int RequestSocket(const std::string& group_name, | 203 virtual 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 virtual 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 virtual 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 virtual 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 virtual void FlushWithError(int error) override; |
| 223 | 223 |
| 224 virtual void CloseIdleSockets() OVERRIDE; | 224 virtual void CloseIdleSockets() override; |
| 225 | 225 |
| 226 virtual int IdleSocketCount() const OVERRIDE; | 226 virtual int IdleSocketCount() const override; |
| 227 | 227 |
| 228 virtual int IdleSocketCountInGroup( | 228 virtual int IdleSocketCountInGroup( |
| 229 const std::string& group_name) const OVERRIDE; | 229 const std::string& group_name) const override; |
| 230 | 230 |
| 231 virtual LoadState GetLoadState( | 231 virtual LoadState GetLoadState( |
| 232 const std::string& group_name, | 232 const std::string& group_name, |
| 233 const ClientSocketHandle* handle) const OVERRIDE; | 233 const ClientSocketHandle* handle) const override; |
| 234 | 234 |
| 235 virtual base::DictionaryValue* GetInfoAsValue( | 235 virtual base::DictionaryValue* GetInfoAsValue( |
| 236 const std::string& name, | 236 const std::string& name, |
| 237 const std::string& type, | 237 const std::string& type, |
| 238 bool include_nested_pools) const OVERRIDE; | 238 bool include_nested_pools) const override; |
| 239 | 239 |
| 240 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; | 240 virtual base::TimeDelta ConnectionTimeout() const override; |
| 241 | 241 |
| 242 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; | 242 virtual ClientSocketPoolHistograms* histograms() const override; |
| 243 | 243 |
| 244 // LowerLayeredPool implementation. | 244 // LowerLayeredPool implementation. |
| 245 virtual bool IsStalled() const OVERRIDE; | 245 virtual bool IsStalled() const override; |
| 246 | 246 |
| 247 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; | 247 virtual void AddHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
| 248 | 248 |
| 249 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) OVERRIDE; | 249 virtual void RemoveHigherLayeredPool(HigherLayeredPool* higher_pool) override; |
| 250 | 250 |
| 251 // HigherLayeredPool implementation. | 251 // HigherLayeredPool implementation. |
| 252 virtual bool CloseOneIdleConnection() OVERRIDE; | 252 virtual bool CloseOneIdleConnection() override; |
| 253 | 253 |
| 254 private: | 254 private: |
| 255 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; | 255 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; |
| 256 | 256 |
| 257 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { | 257 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { |
| 258 public: | 258 public: |
| 259 HttpProxyConnectJobFactory( | 259 HttpProxyConnectJobFactory( |
| 260 TransportClientSocketPool* transport_pool, | 260 TransportClientSocketPool* transport_pool, |
| 261 SSLClientSocketPool* ssl_pool, | 261 SSLClientSocketPool* ssl_pool, |
| 262 HostResolver* host_resolver, | 262 HostResolver* host_resolver, |
| 263 const ProxyDelegate* proxy_delegate, | 263 const ProxyDelegate* proxy_delegate, |
| 264 NetLog* net_log); | 264 NetLog* net_log); |
| 265 | 265 |
| 266 // ClientSocketPoolBase::ConnectJobFactory methods. | 266 // ClientSocketPoolBase::ConnectJobFactory methods. |
| 267 virtual scoped_ptr<ConnectJob> NewConnectJob( | 267 virtual scoped_ptr<ConnectJob> NewConnectJob( |
| 268 const std::string& group_name, | 268 const std::string& group_name, |
| 269 const PoolBase::Request& request, | 269 const PoolBase::Request& request, |
| 270 ConnectJob::Delegate* delegate) const OVERRIDE; | 270 ConnectJob::Delegate* delegate) const override; |
| 271 | 271 |
| 272 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; | 272 virtual base::TimeDelta ConnectionTimeout() const override; |
| 273 | 273 |
| 274 private: | 274 private: |
| 275 TransportClientSocketPool* const transport_pool_; | 275 TransportClientSocketPool* const transport_pool_; |
| 276 SSLClientSocketPool* const ssl_pool_; | 276 SSLClientSocketPool* const ssl_pool_; |
| 277 HostResolver* const host_resolver_; | 277 HostResolver* const host_resolver_; |
| 278 const ProxyDelegate* proxy_delegate_; | 278 const ProxyDelegate* proxy_delegate_; |
| 279 NetLog* net_log_; | 279 NetLog* net_log_; |
| 280 base::TimeDelta timeout_; | 280 base::TimeDelta timeout_; |
| 281 | 281 |
| 282 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); | 282 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); |
| 283 }; | 283 }; |
| 284 | 284 |
| 285 TransportClientSocketPool* const transport_pool_; | 285 TransportClientSocketPool* const transport_pool_; |
| 286 SSLClientSocketPool* const ssl_pool_; | 286 SSLClientSocketPool* const ssl_pool_; |
| 287 PoolBase base_; | 287 PoolBase base_; |
| 288 | 288 |
| 289 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); | 289 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); |
| 290 }; | 290 }; |
| 291 | 291 |
| 292 } // namespace net | 292 } // namespace net |
| 293 | 293 |
| 294 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 294 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |