| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 void TransportConnectJob::MakeAddressListStartWithIPv4(AddressList* list) { | 231 void TransportConnectJob::MakeAddressListStartWithIPv4(AddressList* list) { |
| 232 for (AddressList::iterator i = list->begin(); i != list->end(); ++i) { | 232 for (AddressList::iterator i = list->begin(); i != list->end(); ++i) { |
| 233 if (i->GetFamily() == ADDRESS_FAMILY_IPV4) { | 233 if (i->GetFamily() == ADDRESS_FAMILY_IPV4) { |
| 234 std::rotate(list->begin(), i, list->end()); | 234 std::rotate(list->begin(), i, list->end()); |
| 235 break; | 235 break; |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 int TransportConnectJob::DoResolveHost() { | 240 int TransportConnectJob::DoResolveHost() { |
| 241 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 242 tracked_objects::ScopedTracker tracking_profile( |
| 243 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 244 "436634 TransportConnectJob::DoResolveHost")); |
| 245 |
| 241 return helper_.DoResolveHost(priority(), net_log()); | 246 return helper_.DoResolveHost(priority(), net_log()); |
| 242 } | 247 } |
| 243 | 248 |
| 244 int TransportConnectJob::DoResolveHostComplete(int result) { | 249 int TransportConnectJob::DoResolveHostComplete(int result) { |
| 250 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 251 tracked_objects::ScopedTracker tracking_profile( |
| 252 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 253 "436634 TransportConnectJob::DoResolveHostComplete")); |
| 254 |
| 245 return helper_.DoResolveHostComplete(result, net_log()); | 255 return helper_.DoResolveHostComplete(result, net_log()); |
| 246 } | 256 } |
| 247 | 257 |
| 248 int TransportConnectJob::DoTransportConnect() { | 258 int TransportConnectJob::DoTransportConnect() { |
| 259 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 260 tracked_objects::ScopedTracker tracking_profile( |
| 261 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 262 "436634 TransportConnectJob::DoTransportConnect")); |
| 263 |
| 249 base::TimeTicks now = base::TimeTicks::Now(); | 264 base::TimeTicks now = base::TimeTicks::Now(); |
| 250 base::TimeTicks last_connect_time; | 265 base::TimeTicks last_connect_time; |
| 251 { | 266 { |
| 252 base::AutoLock lock(g_last_connect_time_lock.Get()); | 267 base::AutoLock lock(g_last_connect_time_lock.Get()); |
| 253 last_connect_time = g_last_connect_time.Get(); | 268 last_connect_time = g_last_connect_time.Get(); |
| 254 *g_last_connect_time.Pointer() = now; | 269 *g_last_connect_time.Pointer() = now; |
| 255 } | 270 } |
| 256 if (last_connect_time.is_null()) { | 271 if (last_connect_time.is_null()) { |
| 257 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; | 272 interval_between_connects_ = CONNECT_INTERVAL_GT_20MS; |
| 258 } else { | 273 } else { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 FROM_HERE, | 308 FROM_HERE, |
| 294 base::TimeDelta::FromMilliseconds( | 309 base::TimeDelta::FromMilliseconds( |
| 295 TransportConnectJobHelper::kIPv6FallbackTimerInMs), | 310 TransportConnectJobHelper::kIPv6FallbackTimerInMs), |
| 296 this, | 311 this, |
| 297 &TransportConnectJob::DoIPv6FallbackTransportConnect); | 312 &TransportConnectJob::DoIPv6FallbackTransportConnect); |
| 298 } | 313 } |
| 299 return rv; | 314 return rv; |
| 300 } | 315 } |
| 301 | 316 |
| 302 int TransportConnectJob::DoTransportConnectComplete(int result) { | 317 int TransportConnectJob::DoTransportConnectComplete(int result) { |
| 318 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436634 is fixed. |
| 319 tracked_objects::ScopedTracker tracking_profile( |
| 320 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 321 "436634 TransportConnectJob::DoTransportConnectComplete")); |
| 322 |
| 303 if (result == OK) { | 323 if (result == OK) { |
| 304 bool is_ipv4 = | 324 bool is_ipv4 = |
| 305 helper_.addresses().front().GetFamily() == ADDRESS_FAMILY_IPV4; | 325 helper_.addresses().front().GetFamily() == ADDRESS_FAMILY_IPV4; |
| 306 TransportConnectJobHelper::ConnectionLatencyHistogram race_result = | 326 TransportConnectJobHelper::ConnectionLatencyHistogram race_result = |
| 307 TransportConnectJobHelper::CONNECTION_LATENCY_UNKNOWN; | 327 TransportConnectJobHelper::CONNECTION_LATENCY_UNKNOWN; |
| 308 if (is_ipv4) { | 328 if (is_ipv4) { |
| 309 race_result = TransportConnectJobHelper::CONNECTION_LATENCY_IPV4_NO_RACE; | 329 race_result = TransportConnectJobHelper::CONNECTION_LATENCY_IPV4_NO_RACE; |
| 310 } else { | 330 } else { |
| 311 if (AddressListOnlyContainsIPv6(helper_.addresses())) { | 331 if (AddressListOnlyContainsIPv6(helper_.addresses())) { |
| 312 race_result = TransportConnectJobHelper::CONNECTION_LATENCY_IPV6_SOLO; | 332 race_result = TransportConnectJobHelper::CONNECTION_LATENCY_IPV6_SOLO; |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 HigherLayeredPool* higher_pool) { | 579 HigherLayeredPool* higher_pool) { |
| 560 base_.AddHigherLayeredPool(higher_pool); | 580 base_.AddHigherLayeredPool(higher_pool); |
| 561 } | 581 } |
| 562 | 582 |
| 563 void TransportClientSocketPool::RemoveHigherLayeredPool( | 583 void TransportClientSocketPool::RemoveHigherLayeredPool( |
| 564 HigherLayeredPool* higher_pool) { | 584 HigherLayeredPool* higher_pool) { |
| 565 base_.RemoveHigherLayeredPool(higher_pool); | 585 base_.RemoveHigherLayeredPool(higher_pool); |
| 566 } | 586 } |
| 567 | 587 |
| 568 } // namespace net | 588 } // namespace net |
| OLD | NEW |