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

Unified Diff: net/socket/client_socket_pool_base.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: Missed one 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
Index: net/socket/client_socket_pool_base.cc
diff --git a/net/socket/client_socket_pool_base.cc b/net/socket/client_socket_pool_base.cc
index 4a76913b7a44fe1e126f344eac9c38163f3987dd..96d03996860a8afe11ed59c8f5aeda76fadaab7d 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -53,11 +53,13 @@ bool g_connect_backup_jobs_enabled = true;
ConnectJob::ConnectJob(const std::string& group_name,
base::TimeDelta timeout_duration,
RequestPriority priority,
+ ClientSocketPool::IgnoreLimits ignore_limits,
Delegate* delegate,
const BoundNetLog& net_log)
: group_name_(group_name),
timeout_duration_(timeout_duration),
priority_(priority),
+ ignore_limits_(ignore_limits),
delegate_(delegate),
net_log_(net_log),
idle_(true) {
@@ -141,7 +143,7 @@ ClientSocketPoolBaseHelper::Request::Request(
ClientSocketHandle* handle,
const CompletionCallback& callback,
RequestPriority priority,
- bool ignore_limits,
+ ClientSocketPool::IgnoreLimits ignore_limits,
Flags flags,
const BoundNetLog& net_log)
: handle_(handle),
@@ -150,7 +152,7 @@ ClientSocketPoolBaseHelper::Request::Request(
ignore_limits_(ignore_limits),
flags_(flags),
net_log_(net_log) {
- if (ignore_limits_)
+ if (ignore_limits_ == ClientSocketPool::IgnoreLimits::ENABLED)
DCHECK_EQ(priority_, MAXIMUM_PRIORITY);
}
@@ -378,7 +380,7 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal(
// Can we make another active socket now?
if (!group->HasAvailableSocketSlot(max_sockets_per_group_) &&
- !request.ignore_limits()) {
+ request.ignore_limits() == ClientSocketPool::IgnoreLimits::DISABLED) {
// TODO(willchan): Consider whether or not we need to close a socket in a
// higher layered group. I don't think this makes sense since we would just
// reuse that socket then if we needed one and wouldn't make it down to this
@@ -388,7 +390,8 @@ int ClientSocketPoolBaseHelper::RequestSocketInternal(
return ERR_IO_PENDING;
}
- if (ReachedMaxSocketsLimit() && !request.ignore_limits()) {
+ if (ReachedMaxSocketsLimit() &&
+ request.ignore_limits() == ClientSocketPool::IgnoreLimits::DISABLED) {
eroman 2016/01/27 20:15:13 Perhaps there aren't enough callers, but could cre
mmenke 2016/01/27 20:37:27 Too bad enum classes can't have methods. Think it
eroman 2016/01/27 20:40:21 ok
// NOTE(mmenke): Wonder if we really need different code for each case
// here. Only reason for them now seems to be preconnects.
if (idle_socket_count() > 0) {
@@ -1302,7 +1305,7 @@ void ClientSocketPoolBaseHelper::Group::InsertPendingRequest(
scoped_ptr<const Request> request) {
// This value must be cached before we release |request|.
RequestPriority priority = request->priority();
- if (request->ignore_limits()) {
+ if (request->ignore_limits() == ClientSocketPool::IgnoreLimits::ENABLED) {
// Put requests with ignore_limits == true (which should have
// priority == MAXIMUM_PRIORITY) ahead of other requests with
// MAXIMUM_PRIORITY.

Powered by Google App Engine
This is Rietveld 408576698