Chromium Code Reviews| 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 675 StartLookupAttempt(); | 675 StartLookupAttempt(); |
| 676 } | 676 } |
| 677 | 677 |
| 678 // Callback for when DoLookup() completes (runs on origin thread). | 678 // Callback for when DoLookup() completes (runs on origin thread). |
| 679 void OnLookupComplete(const AddressList& results, | 679 void OnLookupComplete(const AddressList& results, |
| 680 const base::TimeTicks& start_time, | 680 const base::TimeTicks& start_time, |
| 681 const uint32 attempt_number, | 681 const uint32 attempt_number, |
| 682 int error, | 682 int error, |
| 683 const int os_error) { | 683 const int os_error) { |
| 684 DCHECK(origin_loop_->BelongsToCurrentThread()); | 684 DCHECK(origin_loop_->BelongsToCurrentThread()); |
| 685 DCHECK(error || !results.empty()); | 685 // empty results are not OK |
|
szym
2013/05/04 07:46:32
Ok, hold on a second. If this DCHECK is here, then
|
szym
2013/05/04 07:46:32
nit: Comments should be full sentences, with capit
mef
2013/05/06 16:49:11
Done.
|
| 686 if (error == OK && results.empty()) | |
| 687 error = ERR_NAME_NOT_RESOLVED; | |
|
szym
2013/05/04 07:46:32
If you change |error| here then your |empty_list_o
mef
2013/05/06 16:49:11
Done.
| |
| 686 | 688 |
| 687 bool was_retry_attempt = attempt_number > 1; | 689 bool was_retry_attempt = attempt_number > 1; |
| 688 | 690 |
| 689 // Ideally the following code would be part of host_resolver_proc.cc, | 691 // Ideally the following code would be part of host_resolver_proc.cc, |
| 690 // however it isn't safe to call NetworkChangeNotifier from worker threads. | 692 // however it isn't safe to call NetworkChangeNotifier from worker threads. |
| 691 // So we do it here on the IO thread instead. | 693 // So we do it here on the IO thread instead. |
| 692 if (error != OK && NetworkChangeNotifier::IsOffline()) | 694 if (error != OK && NetworkChangeNotifier::IsOffline()) |
| 693 error = ERR_INTERNET_DISCONNECTED; | 695 error = ERR_INTERNET_DISCONNECTED; |
| 694 | 696 |
| 695 // If this is the first attempt that is finishing later, then record data | 697 // If this is the first attempt that is finishing later, then record data |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1430 resolver_->resolved_known_ipv6_hostname_ = true; | 1432 resolver_->resolved_known_ipv6_hostname_ = true; |
| 1431 bool got_ipv6_address = false; | 1433 bool got_ipv6_address = false; |
| 1432 for (size_t i = 0; i < addr_list.size(); ++i) { | 1434 for (size_t i = 0; i < addr_list.size(); ++i) { |
| 1433 if (addr_list[i].GetFamily() == ADDRESS_FAMILY_IPV6) | 1435 if (addr_list[i].GetFamily() == ADDRESS_FAMILY_IPV6) |
| 1434 got_ipv6_address = true; | 1436 got_ipv6_address = true; |
| 1435 } | 1437 } |
| 1436 UMA_HISTOGRAM_BOOLEAN("Net.UnspecResolvedIPv6", got_ipv6_address); | 1438 UMA_HISTOGRAM_BOOLEAN("Net.UnspecResolvedIPv6", got_ipv6_address); |
| 1437 } | 1439 } |
| 1438 } | 1440 } |
| 1439 | 1441 |
| 1442 bool empty_list_on_ok = (net_error == OK && addr_list.empty()); | |
| 1443 UMA_HISTOGRAM_BOOLEAN("Net.DNS_EmptyListOnOk", empty_list_on_ok); | |
|
szym
2013/05/04 07:46:32
I'd suggest putting the histogram in DNS.
Also, wh
mef
2013/05/06 16:49:11
Done.
mef
2013/05/06 16:49:11
Done.
| |
| 1444 if (empty_list_on_ok) { | |
|
szym
2013/05/04 07:46:32
nit: no need for braces
mef
2013/05/06 16:49:11
Done.
| |
| 1445 net_error = ERR_NAME_NOT_RESOLVED; | |
| 1446 } | |
| 1447 | |
| 1440 if (dns_task_error_ != OK) { | 1448 if (dns_task_error_ != OK) { |
| 1441 base::TimeDelta duration = base::TimeTicks::Now() - start_time; | 1449 base::TimeDelta duration = base::TimeTicks::Now() - start_time; |
| 1442 if (net_error == OK) { | 1450 if (net_error == OK) { |
| 1443 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration); | 1451 DNS_HISTOGRAM("AsyncDNS.FallbackSuccess", duration); |
| 1444 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) && | 1452 if ((dns_task_error_ == ERR_NAME_NOT_RESOLVED) && |
| 1445 ResemblesNetBIOSName(key_.hostname)) { | 1453 ResemblesNetBIOSName(key_.hostname)) { |
| 1446 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_SUSPECT_NETBIOS); | 1454 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_SUSPECT_NETBIOS); |
| 1447 } else { | 1455 } else { |
| 1448 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_PROC_SUCCESS); | 1456 UmaAsyncDnsResolveStatus(RESOLVE_STATUS_PROC_SUCCESS); |
| 1449 } | 1457 } |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2229 } | 2237 } |
| 2230 DnsConfig dns_config; | 2238 DnsConfig dns_config; |
| 2231 NetworkChangeNotifier::GetDnsConfig(&dns_config); | 2239 NetworkChangeNotifier::GetDnsConfig(&dns_config); |
| 2232 dns_client_->SetConfig(dns_config); | 2240 dns_client_->SetConfig(dns_config); |
| 2233 num_dns_failures_ = 0; | 2241 num_dns_failures_ = 0; |
| 2234 if (dns_config.IsValid()) | 2242 if (dns_config.IsValid()) |
| 2235 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); | 2243 UMA_HISTOGRAM_BOOLEAN("AsyncDNS.DnsClientEnabled", true); |
| 2236 } | 2244 } |
| 2237 | 2245 |
| 2238 } // namespace net | 2246 } // namespace net |
| OLD | NEW |