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 <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 base::TimeTicks::Now() - idle_socket_it->start_time; | 482 base::TimeTicks::Now() - idle_socket_it->start_time; |
483 IdleSocket idle_socket = *idle_socket_it; | 483 IdleSocket idle_socket = *idle_socket_it; |
484 idle_sockets->erase(idle_socket_it); | 484 idle_sockets->erase(idle_socket_it); |
485 // TODO(davidben): If |idle_time| is under some low watermark, consider | 485 // TODO(davidben): If |idle_time| is under some low watermark, consider |
486 // treating as UNUSED rather than UNUSED_IDLE. This will avoid | 486 // treating as UNUSED rather than UNUSED_IDLE. This will avoid |
487 // HttpNetworkTransaction retrying on some errors. | 487 // HttpNetworkTransaction retrying on some errors. |
488 ClientSocketHandle::SocketReuseType reuse_type = | 488 ClientSocketHandle::SocketReuseType reuse_type = |
489 idle_socket.socket->WasEverUsed() ? | 489 idle_socket.socket->WasEverUsed() ? |
490 ClientSocketHandle::REUSED_IDLE : | 490 ClientSocketHandle::REUSED_IDLE : |
491 ClientSocketHandle::UNUSED_IDLE; | 491 ClientSocketHandle::UNUSED_IDLE; |
| 492 |
| 493 // If this socket took multiple attempts to obtain, don't report those |
| 494 // every time it's reused, just to the first user. |
| 495 if (idle_socket.socket->WasEverUsed()) |
| 496 idle_socket.socket->ClearConnectionAttempts(); |
| 497 |
492 HandOutSocket( | 498 HandOutSocket( |
493 scoped_ptr<StreamSocket>(idle_socket.socket), | 499 scoped_ptr<StreamSocket>(idle_socket.socket), |
494 reuse_type, | 500 reuse_type, |
495 LoadTimingInfo::ConnectTiming(), | 501 LoadTimingInfo::ConnectTiming(), |
496 request.handle(), | 502 request.handle(), |
497 idle_time, | 503 idle_time, |
498 group, | 504 group, |
499 request.net_log()); | 505 request.net_log()); |
500 return true; | 506 return true; |
501 } | 507 } |
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 // If there are no more requests, kill the backup timer. | 1337 // If there are no more requests, kill the backup timer. |
1332 if (pending_requests_.empty()) | 1338 if (pending_requests_.empty()) |
1333 backup_job_timer_.Stop(); | 1339 backup_job_timer_.Stop(); |
1334 request->CrashIfInvalid(); | 1340 request->CrashIfInvalid(); |
1335 return request.Pass(); | 1341 return request.Pass(); |
1336 } | 1342 } |
1337 | 1343 |
1338 } // namespace internal | 1344 } // namespace internal |
1339 | 1345 |
1340 } // namespace net | 1346 } // namespace net |
OLD | NEW |