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

Unified Diff: net/socket/client_socket_pool_base.cc

Issue 19278016: Add load states for stalled requests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix comment Created 7 years, 5 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/base/load_states_list.h ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/client_socket_pool_base.cc
===================================================================
--- net/socket/client_socket_pool_base.cc (revision 211022)
+++ net/socket/client_socket_pool_base.cc (working copy)
@@ -560,27 +560,29 @@
// Can't use operator[] since it is non-const.
const Group& group = *group_map_.find(group_name)->second;
- // Search pending_requests for matching handle.
+ // Search the first group.jobs().size() |pending_requests| for |handle|.
+ // If it's farther back in the deque than that, it doesn't have a
+ // corresponding ConnectJob.
+ size_t connect_jobs = group.jobs().size();
RequestQueue::const_iterator it = group.pending_requests().begin();
- for (size_t i = 0; it != group.pending_requests().end(); ++it, ++i) {
- if ((*it)->handle() == handle) {
- if (i < group.jobs().size()) {
- LoadState max_state = LOAD_STATE_IDLE;
- for (ConnectJobSet::const_iterator job_it = group.jobs().begin();
- job_it != group.jobs().end(); ++job_it) {
- max_state = std::max(max_state, (*job_it)->GetLoadState());
- }
- return max_state;
- } else {
- // TODO(wtc): Add a state for being on the wait list.
- // See http://crbug.com/5077.
- return LOAD_STATE_IDLE;
- }
+ for (size_t i = 0; it != group.pending_requests().end() && i < connect_jobs;
+ ++it, ++i) {
+ if ((*it)->handle() != handle)
+ continue;
+
+ // Just return the state of the farthest along ConnectJob for the first
+ // group.jobs().size() pending requests.
+ LoadState max_state = LOAD_STATE_IDLE;
+ for (ConnectJobSet::const_iterator job_it = group.jobs().begin();
+ job_it != group.jobs().end(); ++job_it) {
+ max_state = std::max(max_state, (*job_it)->GetLoadState());
}
+ return max_state;
}
- NOTREACHED();
- return LOAD_STATE_IDLE;
+ if (group.IsStalledOnPoolMaxSockets(max_sockets_per_group_))
+ return LOAD_STATE_WAITING_FOR_STALLED_SOCKET_POOL;
+ return LOAD_STATE_WAITING_FOR_AVAILABLE_SOCKET;
}
base::DictionaryValue* ClientSocketPoolBaseHelper::GetInfoAsValue(
« no previous file with comments | « net/base/load_states_list.h ('k') | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698