Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: net/socket/ssl_client_socket_pool.cc

Issue 1580903002: Convert ignore_limits from a SocketParam to a socket request argument. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: RespectLimits Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/ssl_client_socket_pool.h ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_pool.cc
diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc
index f9a405854b34e018d2aad8af16b0ebb0ba23a646..371ec00ca24f06a94ce770a9377e4cdd5807f5e2 100644
--- a/net/socket/ssl_client_socket_pool.cc
+++ b/net/socket/ssl_client_socket_pool.cc
@@ -45,19 +45,11 @@ SSLSocketParams::SSLSocketParams(
ssl_config_(ssl_config),
privacy_mode_(privacy_mode),
load_flags_(load_flags),
- expect_spdy_(expect_spdy),
- ignore_limits_(false) {
- if (direct_params_.get()) {
- DCHECK(!socks_proxy_params_.get());
- DCHECK(!http_proxy_params_.get());
- ignore_limits_ = direct_params_->ignore_limits();
- } else if (socks_proxy_params_.get()) {
- DCHECK(!http_proxy_params_.get());
- ignore_limits_ = socks_proxy_params_->ignore_limits();
- } else {
- DCHECK(http_proxy_params_.get());
- ignore_limits_ = http_proxy_params_->ignore_limits();
- }
+ expect_spdy_(expect_spdy) {
+ // Only one set of lower level pool params should be non-NULL.
+ DCHECK((direct_params_ && !socks_proxy_params_ && !http_proxy_params_) ||
+ (!direct_params_ && socks_proxy_params_ && !http_proxy_params_) ||
+ (!direct_params_ && !socks_proxy_params_ && http_proxy_params_));
}
SSLSocketParams::~SSLSocketParams() {}
@@ -101,6 +93,7 @@ static const int kSSLHandshakeTimeoutInSeconds = 30;
SSLConnectJob::SSLConnectJob(const std::string& group_name,
RequestPriority priority,
+ ClientSocketPool::RespectLimits respect_limits,
const scoped_refptr<SSLSocketParams>& params,
const base::TimeDelta& timeout_duration,
TransportClientSocketPool* transport_pool,
@@ -113,6 +106,7 @@ SSLConnectJob::SSLConnectJob(const std::string& group_name,
: ConnectJob(group_name,
timeout_duration,
priority,
+ respect_limits,
delegate,
BoundNetLog::Make(net_log, NetLog::SOURCE_CONNECT_JOB)),
params_(params),
@@ -129,8 +123,7 @@ SSLConnectJob::SSLConnectJob(const std::string& group_name,
? "pm/" + context.ssl_session_cache_shard
: context.ssl_session_cache_shard)),
callback_(
- base::Bind(&SSLConnectJob::OnIOComplete, base::Unretained(this))) {
-}
+ base::Bind(&SSLConnectJob::OnIOComplete, base::Unretained(this))) {}
SSLConnectJob::~SSLConnectJob() {
}
@@ -232,7 +225,8 @@ int SSLConnectJob::DoTransportConnect() {
scoped_refptr<TransportSocketParams> direct_params =
params_->GetDirectConnectionParams();
return transport_socket_handle_->Init(group_name(), direct_params, priority(),
- callback_, transport_pool_, net_log());
+ respect_limits(), callback_,
+ transport_pool_, net_log());
}
int SSLConnectJob::DoTransportConnectComplete(int result) {
@@ -252,8 +246,8 @@ int SSLConnectJob::DoSOCKSConnect() {
scoped_refptr<SOCKSSocketParams> socks_proxy_params =
params_->GetSocksProxyConnectionParams();
return transport_socket_handle_->Init(group_name(), socks_proxy_params,
- priority(), callback_, socks_pool_,
- net_log());
+ priority(), respect_limits(), callback_,
+ socks_pool_, net_log());
}
int SSLConnectJob::DoSOCKSConnectComplete(int result) {
@@ -271,8 +265,8 @@ int SSLConnectJob::DoTunnelConnect() {
scoped_refptr<HttpProxySocketParams> http_proxy_params =
params_->GetHttpProxyConnectionParams();
return transport_socket_handle_->Init(group_name(), http_proxy_params,
- priority(), callback_, http_proxy_pool_,
- net_log());
+ priority(), respect_limits(), callback_,
+ http_proxy_pool_, net_log());
}
int SSLConnectJob::DoTunnelConnectComplete(int result) {
@@ -558,17 +552,10 @@ scoped_ptr<ConnectJob> SSLClientSocketPool::SSLConnectJobFactory::NewConnectJob(
const std::string& group_name,
const PoolBase::Request& request,
ConnectJob::Delegate* delegate) const {
- return scoped_ptr<ConnectJob>(new SSLConnectJob(group_name,
- request.priority(),
- request.params(),
- ConnectionTimeout(),
- transport_pool_,
- socks_pool_,
- http_proxy_pool_,
- client_socket_factory_,
- context_,
- delegate,
- net_log_));
+ return scoped_ptr<ConnectJob>(new SSLConnectJob(
+ group_name, request.priority(), request.respect_limits(),
+ request.params(), ConnectionTimeout(), transport_pool_, socks_pool_,
+ http_proxy_pool_, client_socket_factory_, context_, delegate, net_log_));
}
base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout()
@@ -579,6 +566,7 @@ base::TimeDelta SSLClientSocketPool::SSLConnectJobFactory::ConnectionTimeout()
int SSLClientSocketPool::RequestSocket(const std::string& group_name,
const void* socket_params,
RequestPriority priority,
+ RespectLimits respect_limits,
ClientSocketHandle* handle,
const CompletionCallback& callback,
const BoundNetLog& net_log) {
@@ -586,7 +574,7 @@ int SSLClientSocketPool::RequestSocket(const std::string& group_name,
static_cast<const scoped_refptr<SSLSocketParams>*>(socket_params);
return base_.RequestSocket(group_name, *casted_socket_params, priority,
- handle, callback, net_log);
+ respect_limits, handle, callback, net_log);
}
void SSLClientSocketPool::RequestSockets(
« no previous file with comments | « net/socket/ssl_client_socket_pool.h ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698