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/dns/host_resolver_impl.h" | 5 #include "net/dns/host_resolver_impl.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <Winsock2.h> | 8 #include <Winsock2.h> |
9 #elif defined(OS_POSIX) | 9 #elif defined(OS_POSIX) |
10 #include <netdb.h> | 10 #include <netdb.h> |
(...skipping 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 } | 2148 } |
2149 | 2149 |
2150 HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest( | 2150 HostResolverImpl::Key HostResolverImpl::GetEffectiveKeyForRequest( |
2151 const RequestInfo& info, const BoundNetLog& net_log) const { | 2151 const RequestInfo& info, const BoundNetLog& net_log) const { |
2152 HostResolverFlags effective_flags = | 2152 HostResolverFlags effective_flags = |
2153 info.host_resolver_flags() | additional_resolver_flags_; | 2153 info.host_resolver_flags() | additional_resolver_flags_; |
2154 AddressFamily effective_address_family = info.address_family(); | 2154 AddressFamily effective_address_family = info.address_family(); |
2155 | 2155 |
2156 if (info.address_family() == ADDRESS_FAMILY_UNSPECIFIED) { | 2156 if (info.address_family() == ADDRESS_FAMILY_UNSPECIFIED) { |
2157 if (probe_ipv6_support_ && !use_local_ipv6_) { | 2157 if (probe_ipv6_support_ && !use_local_ipv6_) { |
2158 base::TimeTicks start_time = base::TimeTicks::Now(); | |
2159 // Google DNS address. | 2158 // Google DNS address. |
2160 const uint8 kIPv6Address[] = | 2159 const uint8 kIPv6Address[] = |
2161 { 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, | 2160 { 0x20, 0x01, 0x48, 0x60, 0x48, 0x60, 0x00, 0x00, |
2162 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 }; | 2161 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x88 }; |
2163 IPAddressNumber address(kIPv6Address, | 2162 IPAddressNumber address(kIPv6Address, |
2164 kIPv6Address + arraysize(kIPv6Address)); | 2163 kIPv6Address + arraysize(kIPv6Address)); |
2165 BoundNetLog probe_net_log = BoundNetLog::Make( | 2164 BoundNetLog probe_net_log = BoundNetLog::Make( |
2166 net_log.net_log(), NetLog::SOURCE_IPV6_REACHABILITY_CHECK); | 2165 net_log.net_log(), NetLog::SOURCE_IPV6_REACHABILITY_CHECK); |
2167 probe_net_log.BeginEvent(NetLog::TYPE_IPV6_REACHABILITY_CHECK, | 2166 probe_net_log.BeginEvent(NetLog::TYPE_IPV6_REACHABILITY_CHECK, |
2168 net_log.source().ToEventParametersCallback()); | 2167 net_log.source().ToEventParametersCallback()); |
2169 bool rv6 = IsGloballyReachable(address, probe_net_log); | 2168 bool rv6 = IsGloballyReachable(address, probe_net_log); |
2170 probe_net_log.EndEvent(NetLog::TYPE_IPV6_REACHABILITY_CHECK); | 2169 probe_net_log.EndEvent(NetLog::TYPE_IPV6_REACHABILITY_CHECK); |
2171 if (rv6) | 2170 if (rv6) |
2172 net_log.AddEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_IPV6_SUPPORTED); | 2171 net_log.AddEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_IPV6_SUPPORTED); |
2173 | 2172 |
2174 UMA_HISTOGRAM_TIMES("Net.IPv6ConnectDuration", | |
2175 base::TimeTicks::Now() - start_time); | |
2176 if (rv6) { | 2173 if (rv6) { |
2177 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectSuccessMatch", | 2174 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectSuccessMatch", |
2178 default_address_family_ == ADDRESS_FAMILY_UNSPECIFIED); | 2175 default_address_family_ == ADDRESS_FAMILY_UNSPECIFIED); |
2179 } else { | 2176 } else { |
2180 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectFailureMatch", | 2177 UMA_HISTOGRAM_BOOLEAN("Net.IPv6ConnectFailureMatch", |
2181 default_address_family_ != ADDRESS_FAMILY_UNSPECIFIED); | 2178 default_address_family_ != ADDRESS_FAMILY_UNSPECIFIED); |
2182 | 2179 |
2183 effective_address_family = ADDRESS_FAMILY_IPV4; | 2180 effective_address_family = ADDRESS_FAMILY_IPV4; |
2184 effective_flags |= HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6; | 2181 effective_flags |= HOST_RESOLVER_DEFAULT_FAMILY_SET_DUE_TO_NO_IPV6; |
2185 } | 2182 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2359 dns_client_->SetConfig(dns_config); | 2356 dns_client_->SetConfig(dns_config); |
2360 num_dns_failures_ = 0; | 2357 num_dns_failures_ = 0; |
2361 if (dns_client_->GetConfig()) | 2358 if (dns_client_->GetConfig()) |
2362 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2359 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
2363 } | 2360 } |
2364 | 2361 |
2365 AbortDnsTasks(); | 2362 AbortDnsTasks(); |
2366 } | 2363 } |
2367 | 2364 |
2368 } // namespace net | 2365 } // namespace net |
OLD | NEW |