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

Unified Diff: net/socket/client_socket_pool_base.cc

Issue 966943005: Socket pools: Remove redundant seach for a group in GetLoadState. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comment Created 5 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 d1ff627dd08bce18ebab251c61d504ebe4e9058c..4bc44f5999eae784f7a7f4804d73928daa79e486 100644
--- a/net/socket/client_socket_pool_base.cc
+++ b/net/socket/client_socket_pool_base.cc
@@ -562,22 +562,18 @@ LoadState ClientSocketPoolBaseHelper::GetLoadState(
if (ContainsKey(pending_callback_map_, handle))
return LOAD_STATE_CONNECTING;
- if (!ContainsKey(group_map_, group_name)) {
- NOTREACHED() << "ClientSocketPool does not contain group: " << group_name
- << " for handle: " << handle;
- return LOAD_STATE_IDLE;
- }
-
- // Can't use operator[] since it is non-const.
- const Group& group = *group_map_.find(group_name)->second;
+ GroupMap::const_iterator group_it = group_map_.find(group_name);
+ // TODO(mmenke): Switch to DCHECK once sure this doesn't break anything.
+ // Added in M43.
+ CHECK(group_it != group_map_.end());
+ const Group& group = *group_it->second;
if (group.HasConnectJobForHandle(handle)) {
- // Just return the state of the farthest along ConnectJob for the first
+ // 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());
+ for (const auto& job : group.jobs()) {
+ max_state = std::max(max_state, job->GetLoadState());
}
return max_state;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698