| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 const scoped_refptr<HttpProxySocketParams>& params, | 97 const scoped_refptr<HttpProxySocketParams>& params, |
| 98 const base::TimeDelta& timeout_duration, | 98 const base::TimeDelta& timeout_duration, |
| 99 TransportClientSocketPool* transport_pool, | 99 TransportClientSocketPool* transport_pool, |
| 100 SSLClientSocketPool* ssl_pool, | 100 SSLClientSocketPool* ssl_pool, |
| 101 HostResolver* host_resolver, | 101 HostResolver* host_resolver, |
| 102 Delegate* delegate, | 102 Delegate* delegate, |
| 103 NetLog* net_log); | 103 NetLog* net_log); |
| 104 virtual ~HttpProxyConnectJob(); | 104 virtual ~HttpProxyConnectJob(); |
| 105 | 105 |
| 106 // ConnectJob methods. | 106 // ConnectJob methods. |
| 107 virtual LoadState GetLoadState() const; | 107 virtual LoadState GetLoadState() const OVERRIDE; |
| 108 | 108 |
| 109 virtual void GetAdditionalErrorState(ClientSocketHandle* handle); | 109 virtual void GetAdditionalErrorState(ClientSocketHandle* handle) OVERRIDE; |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 enum State { | 112 enum State { |
| 113 STATE_TCP_CONNECT, | 113 STATE_TCP_CONNECT, |
| 114 STATE_TCP_CONNECT_COMPLETE, | 114 STATE_TCP_CONNECT_COMPLETE, |
| 115 STATE_SSL_CONNECT, | 115 STATE_SSL_CONNECT, |
| 116 STATE_SSL_CONNECT_COMPLETE, | 116 STATE_SSL_CONNECT_COMPLETE, |
| 117 STATE_HTTP_PROXY_CONNECT, | 117 STATE_HTTP_PROXY_CONNECT, |
| 118 STATE_HTTP_PROXY_CONNECT_COMPLETE, | 118 STATE_HTTP_PROXY_CONNECT_COMPLETE, |
| 119 STATE_SPDY_PROXY_CREATE_STREAM, | 119 STATE_SPDY_PROXY_CREATE_STREAM, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 140 int DoSpdyProxyCreateStream(); | 140 int DoSpdyProxyCreateStream(); |
| 141 int DoSpdyProxyCreateStreamComplete(int result); | 141 int DoSpdyProxyCreateStreamComplete(int result); |
| 142 | 142 |
| 143 // Begins the tcp connection and the optional Http proxy tunnel. If the | 143 // Begins the tcp connection and the optional Http proxy tunnel. If the |
| 144 // request is not immediately servicable (likely), the request will return | 144 // request is not immediately servicable (likely), the request will return |
| 145 // ERR_IO_PENDING. An OK return from this function or the callback means | 145 // ERR_IO_PENDING. An OK return from this function or the callback means |
| 146 // that the connection is established; ERR_PROXY_AUTH_REQUESTED means | 146 // that the connection is established; ERR_PROXY_AUTH_REQUESTED means |
| 147 // that the tunnel needs authentication credentials, the socket will be | 147 // that the tunnel needs authentication credentials, the socket will be |
| 148 // returned in this case, and must be release back to the pool; or | 148 // returned in this case, and must be release back to the pool; or |
| 149 // a standard net error code will be returned. | 149 // a standard net error code will be returned. |
| 150 virtual int ConnectInternal(); | 150 virtual int ConnectInternal() OVERRIDE; |
| 151 | 151 |
| 152 scoped_refptr<HttpProxySocketParams> params_; | 152 scoped_refptr<HttpProxySocketParams> params_; |
| 153 TransportClientSocketPool* const transport_pool_; | 153 TransportClientSocketPool* const transport_pool_; |
| 154 SSLClientSocketPool* const ssl_pool_; | 154 SSLClientSocketPool* const ssl_pool_; |
| 155 HostResolver* const resolver_; | 155 HostResolver* const resolver_; |
| 156 | 156 |
| 157 State next_state_; | 157 State next_state_; |
| 158 OldCompletionCallbackImpl<HttpProxyConnectJob> callback_; | 158 OldCompletionCallbackImpl<HttpProxyConnectJob> callback_; |
| 159 scoped_ptr<ClientSocketHandle> transport_socket_handle_; | 159 scoped_ptr<ClientSocketHandle> transport_socket_handle_; |
| 160 scoped_ptr<ProxyClientSocket> transport_socket_; | 160 scoped_ptr<ProxyClientSocket> transport_socket_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 179 NetLog* net_log); | 179 NetLog* net_log); |
| 180 | 180 |
| 181 virtual ~HttpProxyClientSocketPool(); | 181 virtual ~HttpProxyClientSocketPool(); |
| 182 | 182 |
| 183 // ClientSocketPool methods: | 183 // ClientSocketPool methods: |
| 184 virtual int RequestSocket(const std::string& group_name, | 184 virtual int RequestSocket(const std::string& group_name, |
| 185 const void* connect_params, | 185 const void* connect_params, |
| 186 RequestPriority priority, | 186 RequestPriority priority, |
| 187 ClientSocketHandle* handle, | 187 ClientSocketHandle* handle, |
| 188 OldCompletionCallback* callback, | 188 OldCompletionCallback* callback, |
| 189 const BoundNetLog& net_log); | 189 const BoundNetLog& net_log) OVERRIDE; |
| 190 | 190 |
| 191 virtual void RequestSockets(const std::string& group_name, | 191 virtual void RequestSockets(const std::string& group_name, |
| 192 const void* params, | 192 const void* params, |
| 193 int num_sockets, | 193 int num_sockets, |
| 194 const BoundNetLog& net_log); | 194 const BoundNetLog& net_log) OVERRIDE; |
| 195 | 195 |
| 196 virtual void CancelRequest(const std::string& group_name, | 196 virtual void CancelRequest(const std::string& group_name, |
| 197 ClientSocketHandle* handle); | 197 ClientSocketHandle* handle) OVERRIDE; |
| 198 | 198 |
| 199 virtual void ReleaseSocket(const std::string& group_name, | 199 virtual void ReleaseSocket(const std::string& group_name, |
| 200 StreamSocket* socket, | 200 StreamSocket* socket, |
| 201 int id); | 201 int id) OVERRIDE; |
| 202 | 202 |
| 203 virtual void Flush(); | 203 virtual void Flush() OVERRIDE; |
| 204 | 204 |
| 205 virtual void CloseIdleSockets(); | 205 virtual void CloseIdleSockets() OVERRIDE; |
| 206 | 206 |
| 207 virtual int IdleSocketCount() const; | 207 virtual int IdleSocketCount() const OVERRIDE; |
| 208 | 208 |
| 209 virtual int IdleSocketCountInGroup(const std::string& group_name) const; | 209 virtual int IdleSocketCountInGroup( |
| 210 const std::string& group_name) const OVERRIDE; |
| 210 | 211 |
| 211 virtual LoadState GetLoadState(const std::string& group_name, | 212 virtual LoadState GetLoadState( |
| 212 const ClientSocketHandle* handle) const; | 213 const std::string& group_name, |
| 214 const ClientSocketHandle* handle) const OVERRIDE; |
| 213 | 215 |
| 214 virtual base::DictionaryValue* GetInfoAsValue( | 216 virtual base::DictionaryValue* GetInfoAsValue( |
| 215 const std::string& name, | 217 const std::string& name, |
| 216 const std::string& type, | 218 const std::string& type, |
| 217 bool include_nested_pools) const; | 219 bool include_nested_pools) const OVERRIDE; |
| 218 | 220 |
| 219 virtual base::TimeDelta ConnectionTimeout() const; | 221 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE; |
| 220 | 222 |
| 221 virtual ClientSocketPoolHistograms* histograms() const; | 223 virtual ClientSocketPoolHistograms* histograms() const OVERRIDE; |
| 222 | 224 |
| 223 private: | 225 private: |
| 224 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; | 226 typedef ClientSocketPoolBase<HttpProxySocketParams> PoolBase; |
| 225 | 227 |
| 226 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { | 228 class HttpProxyConnectJobFactory : public PoolBase::ConnectJobFactory { |
| 227 public: | 229 public: |
| 228 HttpProxyConnectJobFactory( | 230 HttpProxyConnectJobFactory( |
| 229 TransportClientSocketPool* transport_pool, | 231 TransportClientSocketPool* transport_pool, |
| 230 SSLClientSocketPool* ssl_pool, | 232 SSLClientSocketPool* ssl_pool, |
| 231 HostResolver* host_resolver, | 233 HostResolver* host_resolver, |
| 232 NetLog* net_log); | 234 NetLog* net_log); |
| 233 | 235 |
| 234 // ClientSocketPoolBase::ConnectJobFactory methods. | 236 // ClientSocketPoolBase::ConnectJobFactory methods. |
| 235 virtual ConnectJob* NewConnectJob(const std::string& group_name, | 237 virtual ConnectJob* NewConnectJob( |
| 236 const PoolBase::Request& request, | 238 const std::string& group_name, |
| 237 ConnectJob::Delegate* delegate) const; | 239 const PoolBase::Request& request, |
| 240 ConnectJob::Delegate* delegate) const OVERRIDE; |
| 238 | 241 |
| 239 virtual base::TimeDelta ConnectionTimeout() const { return timeout_; } | 242 virtual base::TimeDelta ConnectionTimeout() const OVERRIDE { |
| 243 return timeout_; |
| 244 } |
| 240 | 245 |
| 241 private: | 246 private: |
| 242 TransportClientSocketPool* const transport_pool_; | 247 TransportClientSocketPool* const transport_pool_; |
| 243 SSLClientSocketPool* const ssl_pool_; | 248 SSLClientSocketPool* const ssl_pool_; |
| 244 HostResolver* const host_resolver_; | 249 HostResolver* const host_resolver_; |
| 245 NetLog* net_log_; | 250 NetLog* net_log_; |
| 246 base::TimeDelta timeout_; | 251 base::TimeDelta timeout_; |
| 247 | 252 |
| 248 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); | 253 DISALLOW_COPY_AND_ASSIGN(HttpProxyConnectJobFactory); |
| 249 }; | 254 }; |
| 250 | 255 |
| 251 TransportClientSocketPool* const transport_pool_; | 256 TransportClientSocketPool* const transport_pool_; |
| 252 SSLClientSocketPool* const ssl_pool_; | 257 SSLClientSocketPool* const ssl_pool_; |
| 253 PoolBase base_; | 258 PoolBase base_; |
| 254 | 259 |
| 255 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); | 260 DISALLOW_COPY_AND_ASSIGN(HttpProxyClientSocketPool); |
| 256 }; | 261 }; |
| 257 | 262 |
| 258 REGISTER_SOCKET_PARAMS_FOR_POOL(HttpProxyClientSocketPool, | 263 REGISTER_SOCKET_PARAMS_FOR_POOL(HttpProxyClientSocketPool, |
| 259 HttpProxySocketParams); | 264 HttpProxySocketParams); |
| 260 | 265 |
| 261 } // namespace net | 266 } // namespace net |
| 262 | 267 |
| 263 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ | 268 #endif // NET_HTTP_HTTP_PROXY_CLIENT_SOCKET_POOL_H_ |
| OLD | NEW |