Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/socket/client_socket_pool_base.h" | 5 #include "net/socket/client_socket_pool_base.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 556 return i->second->idle_sockets().size(); | 556 return i->second->idle_sockets().size(); |
| 557 } | 557 } |
| 558 | 558 |
| 559 LoadState ClientSocketPoolBaseHelper::GetLoadState( | 559 LoadState ClientSocketPoolBaseHelper::GetLoadState( |
| 560 const std::string& group_name, | 560 const std::string& group_name, |
| 561 const ClientSocketHandle* handle) const { | 561 const ClientSocketHandle* handle) const { |
| 562 if (ContainsKey(pending_callback_map_, handle)) | 562 if (ContainsKey(pending_callback_map_, handle)) |
| 563 return LOAD_STATE_CONNECTING; | 563 return LOAD_STATE_CONNECTING; |
| 564 | 564 |
| 565 GroupMap::const_iterator group_it = group_map_.find(group_name); | 565 GroupMap::const_iterator group_it = group_map_.find(group_name); |
| 566 // TODO(mmenke): Switch to DCHECK once sure this doesn't break anything. | 566 if (group_it == group_map_.end()) { |
| 567 // Added in M43. | 567 // TODO(mmenke): This is actually reachec in the wild, for unknown reasons. |
|
eroman
2015/03/27 19:51:02
reached
mmenke
2015/03/27 19:59:27
Done.
| |
| 568 CHECK(group_it != group_map_.end()); | 568 // Would be great to understand why, and if it's a bug, fix it. If not, |
| 569 // should have a test for that case. | |
| 570 NOTREACHED(); | |
| 571 return LOAD_STATE_IDLE; | |
| 572 } | |
| 573 | |
| 569 const Group& group = *group_it->second; | 574 const Group& group = *group_it->second; |
| 570 | |
| 571 if (group.HasConnectJobForHandle(handle)) { | 575 if (group.HasConnectJobForHandle(handle)) { |
| 572 // Just return the state of the farthest along ConnectJob for the first | 576 // Just return the state of the farthest along ConnectJob for the first |
| 573 // group.jobs().size() pending requests. | 577 // group.jobs().size() pending requests. |
| 574 LoadState max_state = LOAD_STATE_IDLE; | 578 LoadState max_state = LOAD_STATE_IDLE; |
| 575 for (const auto& job : group.jobs()) { | 579 for (const auto& job : group.jobs()) { |
| 576 max_state = std::max(max_state, job->GetLoadState()); | 580 max_state = std::max(max_state, job->GetLoadState()); |
| 577 } | 581 } |
| 578 return max_state; | 582 return max_state; |
| 579 } | 583 } |
| 580 | 584 |
| (...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1330 pending_requests_.Erase(pointer); | 1334 pending_requests_.Erase(pointer); |
| 1331 // If there are no more requests, kill the backup timer. | 1335 // If there are no more requests, kill the backup timer. |
| 1332 if (pending_requests_.empty()) | 1336 if (pending_requests_.empty()) |
| 1333 backup_job_timer_.Stop(); | 1337 backup_job_timer_.Stop(); |
| 1334 return request.Pass(); | 1338 return request.Pass(); |
| 1335 } | 1339 } |
| 1336 | 1340 |
| 1337 } // namespace internal | 1341 } // namespace internal |
| 1338 | 1342 |
| 1339 } // namespace net | 1343 } // namespace net |
| OLD | NEW |