| 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/transport_client_socket_pool.h" | 5 #include "net/socket/transport_client_socket_pool.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/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 base::TimeTicks now = base::TimeTicks::Now(); | 275 base::TimeTicks now = base::TimeTicks::Now(); |
| 276 base::TimeTicks last_connect_time; | 276 base::TimeTicks last_connect_time; |
| 277 { | 277 { |
| 278 base::AutoLock lock(g_last_connect_time_lock.Get()); | 278 base::AutoLock lock(g_last_connect_time_lock.Get()); |
| 279 last_connect_time = g_last_connect_time.Get(); | 279 last_connect_time = g_last_connect_time.Get(); |
| 280 *g_last_connect_time.Pointer() = now; | 280 *g_last_connect_time.Pointer() = now; |
| 281 } | 281 } |
| 282 if (last_connect_time.is_null()) { | 282 if (last_connect_time.is_null()) { |
| 283 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; | 283 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; |
| 284 } else { | 284 } else { |
| 285 int64 interval = (now - last_connect_time).InMilliseconds(); | 285 int64_t interval = (now - last_connect_time).InMilliseconds(); |
| 286 if (interval <= 10) | 286 if (interval <= 10) |
| 287 interval_between_connects_ = CONNECT_INTERVAL_LE_10MS; | 287 interval_between_connects_ = CONNECT_INTERVAL_LE_10MS; |
| 288 else if (interval <= 20) | 288 else if (interval <= 20) |
| 289 interval_between_connects_ = CONNECT_INTERVAL_LE_20MS; | 289 interval_between_connects_ = CONNECT_INTERVAL_LE_20MS; |
| 290 else | 290 else |
| 291 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; | 291 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; |
| 292 } | 292 } |
| 293 | 293 |
| 294 helper_.set_next_state( | 294 helper_.set_next_state( |
| 295 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE); | 295 TransportConnectJobHelper::STATE_TRANSPORT_CONNECT_COMPLETE); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 HigherLayeredPool* higher_pool) { | 623 HigherLayeredPool* higher_pool) { |
| 624 base_.AddHigherLayeredPool(higher_pool); | 624 base_.AddHigherLayeredPool(higher_pool); |
| 625 } | 625 } |
| 626 | 626 |
| 627 void TransportClientSocketPool::RemoveHigherLayeredPool( | 627 void TransportClientSocketPool::RemoveHigherLayeredPool( |
| 628 HigherLayeredPool* higher_pool) { | 628 HigherLayeredPool* higher_pool) { |
| 629 base_.RemoveHigherLayeredPool(higher_pool); | 629 base_.RemoveHigherLayeredPool(higher_pool); |
| 630 } | 630 } |
| 631 | 631 |
| 632 } // namespace net | 632 } // namespace net |
| OLD | NEW |