Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: net/base/host_resolver_impl.cc

Issue 12051052: [net] Add Net.UnspecResolvedIPv6 to measure if getaddrinfo resolves IPv6 addresses. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: exclude errors Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/base/host_resolver_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/base/host_resolver_impl.h" 5 #include "net/base/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 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 // call OnProcTaskComplete, for example, on synchronous failure. 1398 // call OnProcTaskComplete, for example, on synchronous failure.
1399 proc_task_->Start(); 1399 proc_task_->Start();
1400 } 1400 }
1401 1401
1402 // Called by ProcTask when it completes. 1402 // Called by ProcTask when it completes.
1403 void OnProcTaskComplete(base::TimeTicks start_time, 1403 void OnProcTaskComplete(base::TimeTicks start_time,
1404 int net_error, 1404 int net_error,
1405 const AddressList& addr_list) { 1405 const AddressList& addr_list) {
1406 DCHECK(is_proc_running()); 1406 DCHECK(is_proc_running());
1407 1407
1408 if (!resolver_->resolved_known_ipv6_hostname_ &&
1409 net_error == OK &&
1410 key_.address_family == ADDRESS_FAMILY_UNSPECIFIED) {
1411 if (key_.hostname == "www.google.com") {
1412 resolver_->resolved_known_ipv6_hostname_ = true;
1413 bool got_ipv6_address = false;
1414 for (size_t i = 0; i < addr_list.size(); ++i) {
1415 if (addr_list[i].GetFamily() == ADDRESS_FAMILY_IPV6)
1416 got_ipv6_address = true;
1417 }
1418 UMA_HISTOGRAM_BOOLEAN("Net.UnspecResolvedIPv6", got_ipv6_address);
1419 }
1420 }
1421
1408 if (dns_task_error_ != OK) { 1422 if (dns_task_error_ != OK) {
1409 base::TimeDelta duration = base::TimeTicks::Now() - start_time; 1423 base::TimeDelta duration = base::TimeTicks::Now() - start_time;
1410 if (net_error == OK) { 1424 if (net_error == OK) {
1411 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration); 1425 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration);
1412 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) && 1426 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) &&
1413 ResemblesNetBIOSName(key_.hostname)) { 1427 ResemblesNetBIOSName(key_.hostname)) {
1414 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_SUSPECT_NETBIOS); 1428 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_SUSPECT_NETBIOS);
1415 } else { 1429 } else {
1416 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_PROC_SUCCESS); 1430 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_PROC_SUCCESS);
1417 } 1431 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 1666
1653 HostResolverImpl::HostResolverImpl( 1667 HostResolverImpl::HostResolverImpl(
1654 scoped_ptr<HostCache> cache, 1668 scoped_ptr<HostCache> cache,
1655 const PrioritizedDispatcher::Limits& job_limits, 1669 const PrioritizedDispatcher::Limits& job_limits,
1656 const ProcTaskParams& proc_params, 1670 const ProcTaskParams& proc_params,
1657 NetLog* net_log) 1671 NetLog* net_log)
1658 : cache_(cache.Pass()), 1672 : cache_(cache.Pass()),
1659 dispatcher_(job_limits), 1673 dispatcher_(job_limits),
1660 max_queued_jobs_(job_limits.total_jobs * 100u), 1674 max_queued_jobs_(job_limits.total_jobs * 100u),
1661 proc_params_(proc_params), 1675 proc_params_(proc_params),
1676 net_log_(net_log),
1662 default_address_family_(ADDRESS_FAMILY_UNSPECIFIED), 1677 default_address_family_(ADDRESS_FAMILY_UNSPECIFIED),
1663 weak_ptr_factory_(this), 1678 weak_ptr_factory_(this),
1664 probe_weak_ptr_factory_(this), 1679 probe_weak_ptr_factory_(this),
1665 received_dns_config_(false), 1680 received_dns_config_(false),
1666 num_dns_failures_(0), 1681 num_dns_failures_(0),
1667 ipv6_probe_monitoring_(false), 1682 ipv6_probe_monitoring_(false),
1668 additional_resolver_flags_(0), 1683 resolved_known_ipv6_hostname_(false),
1669 net_log_(net_log) { 1684 additional_resolver_flags_(0) {
1670 1685
1671 DCHECK_GE(dispatcher_.num_priorities(), static_cast<size_t>(NUM_PRIORITIES)); 1686 DCHECK_GE(dispatcher_.num_priorities(), static_cast<size_t>(NUM_PRIORITIES));
1672 1687
1673 // Maximum of 4 retry attempts for host resolution. 1688 // Maximum of 4 retry attempts for host resolution.
1674 static const size_t kDefaultMaxRetryAttempts = 4u; 1689 static const size_t kDefaultMaxRetryAttempts = 4u;
1675 1690
1676 if (proc_params_.max_retry_attempts == HostResolver::kDefaultRetryAttempts) 1691 if (proc_params_.max_retry_attempts == HostResolver::kDefaultRetryAttempts)
1677 proc_params_.max_retry_attempts = kDefaultMaxRetryAttempts; 1692 proc_params_.max_retry_attempts = kDefaultMaxRetryAttempts;
1678 1693
1679 #if defined(OS_WIN) 1694 #if defined(OS_WIN)
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2052 2067
2053 for (JobMap::iterator it = jobs_.begin(); self && it != jobs_.end(); ) { 2068 for (JobMap::iterator it = jobs_.begin(); self && it != jobs_.end(); ) {
2054 Job* job = it->second; 2069 Job* job = it->second;
2055 ++it; 2070 ++it;
2056 // This could remove |job| from |jobs_|, but iterator will remain valid. 2071 // This could remove |job| from |jobs_|, but iterator will remain valid.
2057 job->ServeFromHosts(); 2072 job->ServeFromHosts();
2058 } 2073 }
2059 } 2074 }
2060 2075
2061 void HostResolverImpl::OnIPAddressChanged() { 2076 void HostResolverImpl::OnIPAddressChanged() {
2077 resolved_known_ipv6_hostname_ = false;
2062 // Abandon all ProbeJobs. 2078 // Abandon all ProbeJobs.
2063 probe_weak_ptr_factory_.InvalidateWeakPtrs(); 2079 probe_weak_ptr_factory_.InvalidateWeakPtrs();
2064 if (cache_.get()) 2080 if (cache_.get())
2065 cache_->clear(); 2081 cache_->clear();
2066 if (ipv6_probe_monitoring_) 2082 if (ipv6_probe_monitoring_)
2067 new IPv6ProbeJob(probe_weak_ptr_factory_.GetWeakPtr(), net_log_); 2083 new IPv6ProbeJob(probe_weak_ptr_factory_.GetWeakPtr(), net_log_);
2068 #if defined(OS_POSIX) && !defined(OS_MACOSX) 2084 #if defined(OS_POSIX) && !defined(OS_MACOSX)
2069 new LoopbackProbeJob(probe_weak_ptr_factory_.GetWeakPtr()); 2085 new LoopbackProbeJob(probe_weak_ptr_factory_.GetWeakPtr());
2070 #endif 2086 #endif
2071 AbortAllInProgressJobs(); 2087 AbortAllInProgressJobs();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
2155 } 2171 }
2156 DnsConfig dns_config; 2172 DnsConfig dns_config;
2157 NetworkChangeNotifier::GetDnsConfig(&dns_config); 2173 NetworkChangeNotifier::GetDnsConfig(&dns_config);
2158 dns_client_->SetConfig(dns_config); 2174 dns_client_->SetConfig(dns_config);
2159 num_dns_failures_ = 0; 2175 num_dns_failures_ = 0;
2160 if (dns_config.IsValid()) 2176 if (dns_config.IsValid())
2161 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); 2177 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true);
2162 } 2178 }
2163 2179
2164 } // namespace net 2180 } // namespace net
OLDNEW
« no previous file with comments | « net/base/host_resolver_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698