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 46de10e810f7f8a5eaf45eeeeed495caa53fa8c9..976eec8792ac92c06cba13e4a399dc2455ce3fde 100644 |
--- a/net/socket/client_socket_pool_base.cc |
+++ b/net/socket/client_socket_pool_base.cc |
@@ -140,7 +140,10 @@ ClientSocketPoolBaseHelper::Request::Request( |
priority_(priority), |
ignore_limits_(ignore_limits), |
flags_(flags), |
- net_log_(net_log) {} |
+ net_log_(net_log) { |
+ if (ignore_limits_) |
+ DCHECK_EQ(priority_, MAXIMUM_PRIORITY); |
+} |
ClientSocketPoolBaseHelper::Request::~Request() {} |
@@ -1131,9 +1134,7 @@ void ClientSocketPoolBaseHelper::TryToCloseSocketsInLayeredPools() { |
ClientSocketPoolBaseHelper::Group::Group() |
: unassigned_job_count_(0), |
- // The number of priorities is doubled since requests with |
- // |ignore_limits| are prioritized over other requests. |
- pending_requests_(2 * NUM_PRIORITIES), |
+ pending_requests_(NUM_PRIORITIES), |
active_socket_count_(0) {} |
ClientSocketPoolBaseHelper::Group::~Group() { |
@@ -1270,11 +1271,17 @@ bool ClientSocketPoolBaseHelper::Group::HasConnectJobForHandle( |
void ClientSocketPoolBaseHelper::Group::InsertPendingRequest( |
scoped_ptr<const Request> request) { |
- RequestQueue::Priority queue_priority = request->priority(); |
- // Prioritize requests with |ignore_limits| over ones that don't. |
- if (request->ignore_limits()) |
- queue_priority += NUM_PRIORITIES; |
- pending_requests_.Insert(request.release(), queue_priority); |
+ // We must cache this value before we release |request|. |
mmenke
2013/11/01 19:06:39
nit: --We
akalin
2013/11/01 23:15:51
Done.
|
+ RequestPriority priority = request->priority(); |
+ if (request->ignore_limits()) { |
+ // Put requests with ignore_limits == true (which should have |
+ // priority == MAXIMUM_PRIORITY) ahead of other requests with |
+ // MAXIMUM_PRIORITY. |
+ DCHECK_EQ(priority, MAXIMUM_PRIORITY); |
+ pending_requests_.InsertAtFront(request.release(), priority); |
+ } else { |
+ pending_requests_.Insert(request.release(), priority); |
+ } |
} |
scoped_ptr<const ClientSocketPoolBaseHelper::Request> |