| 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 #include "net/http/http_proxy_client_socket_pool.h" | 5 #include "net/http/http_proxy_client_socket_pool.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "base/values.h" | 12 #include "base/values.h" |
| 12 #include "net/base/load_flags.h" | 13 #include "net/base/load_flags.h" |
| 13 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
| 14 #include "net/base/proxy_delegate.h" | 15 #include "net/base/proxy_delegate.h" |
| 15 #include "net/http/http_network_session.h" | 16 #include "net/http/http_network_session.h" |
| 16 #include "net/http/http_proxy_client_socket_wrapper.h" | 17 #include "net/http/http_proxy_client_socket_wrapper.h" |
| 17 #include "net/socket/client_socket_factory.h" | 18 #include "net/socket/client_socket_factory.h" |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 NotifyDelegateOfCompletion(result); | 135 NotifyDelegateOfCompletion(result); |
| 135 // |this| will have been deleted at this point. | 136 // |this| will have been deleted at this point. |
| 136 } | 137 } |
| 137 | 138 |
| 138 int HttpProxyConnectJob::HandleConnectResult(int result) { | 139 int HttpProxyConnectJob::HandleConnectResult(int result) { |
| 139 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) | 140 if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) |
| 140 error_response_info_ = client_socket_->GetAdditionalErrorState(); | 141 error_response_info_ = client_socket_->GetAdditionalErrorState(); |
| 141 | 142 |
| 142 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED || | 143 if (result == OK || result == ERR_PROXY_AUTH_REQUESTED || |
| 143 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { | 144 result == ERR_HTTPS_PROXY_TUNNEL_RESPONSE) { |
| 144 SetSocket(client_socket_.Pass()); | 145 SetSocket(std::move(client_socket_)); |
| 145 } | 146 } |
| 146 return result; | 147 return result; |
| 147 } | 148 } |
| 148 | 149 |
| 149 HttpProxyClientSocketPool:: | 150 HttpProxyClientSocketPool:: |
| 150 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( | 151 HttpProxyConnectJobFactory::HttpProxyConnectJobFactory( |
| 151 TransportClientSocketPool* transport_pool, | 152 TransportClientSocketPool* transport_pool, |
| 152 SSLClientSocketPool* ssl_pool, | 153 SSLClientSocketPool* ssl_pool, |
| 153 NetLog* net_log) | 154 NetLog* net_log) |
| 154 : transport_pool_(transport_pool), | 155 : transport_pool_(transport_pool), |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 241 |
| 241 void HttpProxyClientSocketPool::CancelRequest( | 242 void HttpProxyClientSocketPool::CancelRequest( |
| 242 const std::string& group_name, | 243 const std::string& group_name, |
| 243 ClientSocketHandle* handle) { | 244 ClientSocketHandle* handle) { |
| 244 base_.CancelRequest(group_name, handle); | 245 base_.CancelRequest(group_name, handle); |
| 245 } | 246 } |
| 246 | 247 |
| 247 void HttpProxyClientSocketPool::ReleaseSocket(const std::string& group_name, | 248 void HttpProxyClientSocketPool::ReleaseSocket(const std::string& group_name, |
| 248 scoped_ptr<StreamSocket> socket, | 249 scoped_ptr<StreamSocket> socket, |
| 249 int id) { | 250 int id) { |
| 250 base_.ReleaseSocket(group_name, socket.Pass(), id); | 251 base_.ReleaseSocket(group_name, std::move(socket), id); |
| 251 } | 252 } |
| 252 | 253 |
| 253 void HttpProxyClientSocketPool::FlushWithError(int error) { | 254 void HttpProxyClientSocketPool::FlushWithError(int error) { |
| 254 base_.FlushWithError(error); | 255 base_.FlushWithError(error); |
| 255 } | 256 } |
| 256 | 257 |
| 257 void HttpProxyClientSocketPool::CloseIdleSockets() { | 258 void HttpProxyClientSocketPool::CloseIdleSockets() { |
| 258 base_.CloseIdleSockets(); | 259 base_.CloseIdleSockets(); |
| 259 } | 260 } |
| 260 | 261 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 284 "transport_socket_pool", | 285 "transport_socket_pool", |
| 285 true)); | 286 true)); |
| 286 } | 287 } |
| 287 if (ssl_pool_) { | 288 if (ssl_pool_) { |
| 288 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", | 289 list->Append(ssl_pool_->GetInfoAsValue("ssl_socket_pool", |
| 289 "ssl_socket_pool", | 290 "ssl_socket_pool", |
| 290 true)); | 291 true)); |
| 291 } | 292 } |
| 292 dict->Set("nested_pools", list); | 293 dict->Set("nested_pools", list); |
| 293 } | 294 } |
| 294 return dict.Pass(); | 295 return dict; |
| 295 } | 296 } |
| 296 | 297 |
| 297 base::TimeDelta HttpProxyClientSocketPool::ConnectionTimeout() const { | 298 base::TimeDelta HttpProxyClientSocketPool::ConnectionTimeout() const { |
| 298 return base_.ConnectionTimeout(); | 299 return base_.ConnectionTimeout(); |
| 299 } | 300 } |
| 300 | 301 |
| 301 bool HttpProxyClientSocketPool::IsStalled() const { | 302 bool HttpProxyClientSocketPool::IsStalled() const { |
| 302 return base_.IsStalled(); | 303 return base_.IsStalled(); |
| 303 } | 304 } |
| 304 | 305 |
| 305 void HttpProxyClientSocketPool::AddHigherLayeredPool( | 306 void HttpProxyClientSocketPool::AddHigherLayeredPool( |
| 306 HigherLayeredPool* higher_pool) { | 307 HigherLayeredPool* higher_pool) { |
| 307 base_.AddHigherLayeredPool(higher_pool); | 308 base_.AddHigherLayeredPool(higher_pool); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void HttpProxyClientSocketPool::RemoveHigherLayeredPool( | 311 void HttpProxyClientSocketPool::RemoveHigherLayeredPool( |
| 311 HigherLayeredPool* higher_pool) { | 312 HigherLayeredPool* higher_pool) { |
| 312 base_.RemoveHigherLayeredPool(higher_pool); | 313 base_.RemoveHigherLayeredPool(higher_pool); |
| 313 } | 314 } |
| 314 | 315 |
| 315 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { | 316 bool HttpProxyClientSocketPool::CloseOneIdleConnection() { |
| 316 if (base_.CloseOneIdleSocket()) | 317 if (base_.CloseOneIdleSocket()) |
| 317 return true; | 318 return true; |
| 318 return base_.CloseOneIdleConnectionInHigherLayeredPool(); | 319 return base_.CloseOneIdleConnectionInHigherLayeredPool(); |
| 319 } | 320 } |
| 320 | 321 |
| 321 } // namespace net | 322 } // namespace net |
| OLD | NEW |