Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 653 | 653 |
| 654 base::TimeDelta duration = base::TimeTicks::Now() - start_time; | 654 base::TimeDelta duration = base::TimeTicks::Now() - start_time; |
| 655 if (error == OK) { | 655 if (error == OK) { |
| 656 if (had_non_speculative_request_) { | 656 if (had_non_speculative_request_) { |
| 657 category = RESOLVE_SUCCESS; | 657 category = RESOLVE_SUCCESS; |
| 658 DNS_HISTOGRAM("DNS.ResolveSuccess", duration); | 658 DNS_HISTOGRAM("DNS.ResolveSuccess", duration); |
| 659 } else { | 659 } else { |
| 660 category = RESOLVE_SPECULATIVE_SUCCESS; | 660 category = RESOLVE_SPECULATIVE_SUCCESS; |
| 661 DNS_HISTOGRAM("DNS.ResolveSpeculativeSuccess", duration); | 661 DNS_HISTOGRAM("DNS.ResolveSpeculativeSuccess", duration); |
| 662 } | 662 } |
| 663 | |
| 664 // Log DNS lookups based on address_family. This will help us determine | |
| 665 // if IPv4 or IPv4/6 lookups are faster or slower. | |
| 666 switch(key_.address_family) { | |
| 667 case ADDRESS_FAMILY_IPV4: | |
| 668 DNS_HISTOGRAM("DNS.ResolveSuccess_FAMILY_IPV4", duration); | |
| 669 break; | |
| 670 case ADDRESS_FAMILY_IPV6: | |
| 671 DNS_HISTOGRAM("DNS.ResolveSuccess_FAMILY_IPV6", duration); | |
| 672 break; | |
| 673 case ADDRESS_FAMILY_UNSPECIFIED: | |
| 674 DNS_HISTOGRAM("DNS.ResolveSuccess_FAMILY_UNSPEC", duration); | |
| 675 break; | |
|
jar (doing other things)
2011/06/09 18:30:00
nit: perchance add a default: NOT_REACHED.
The st
cbentzel
2011/06/09 18:47:03
I've had compiler warnings for that case [I believ
| |
| 676 } | |
| 663 } else { | 677 } else { |
| 664 if (had_non_speculative_request_) { | 678 if (had_non_speculative_request_) { |
| 665 category = RESOLVE_FAIL; | 679 category = RESOLVE_FAIL; |
| 666 DNS_HISTOGRAM("DNS.ResolveFail", duration); | 680 DNS_HISTOGRAM("DNS.ResolveFail", duration); |
| 667 } else { | 681 } else { |
| 668 category = RESOLVE_SPECULATIVE_FAIL; | 682 category = RESOLVE_SPECULATIVE_FAIL; |
| 669 DNS_HISTOGRAM("DNS.ResolveSpeculativeFail", duration); | 683 DNS_HISTOGRAM("DNS.ResolveSpeculativeFail", duration); |
| 670 } | 684 } |
| 685 // Log DNS lookups based on address_family. This will help us determine | |
| 686 // if IPv4 or IPv4/6 lookups are faster or slower. | |
| 687 switch(key_.address_family) { | |
| 688 case ADDRESS_FAMILY_IPV4: | |
| 689 DNS_HISTOGRAM("DNS.ResolveFail_FAMILY_IPV4", duration); | |
| 690 break; | |
| 691 case ADDRESS_FAMILY_IPV6: | |
| 692 DNS_HISTOGRAM("DNS.ResolveFail_FAMILY_IPV6", duration); | |
| 693 break; | |
| 694 case ADDRESS_FAMILY_UNSPECIFIED: | |
| 695 DNS_HISTOGRAM("DNS.ResolveFail_FAMILY_UNSPEC", duration); | |
| 696 break; | |
| 697 } | |
| 671 UMA_HISTOGRAM_CUSTOM_ENUMERATION(kOSErrorsForGetAddrinfoHistogramName, | 698 UMA_HISTOGRAM_CUSTOM_ENUMERATION(kOSErrorsForGetAddrinfoHistogramName, |
| 672 std::abs(os_error), | 699 std::abs(os_error), |
| 673 GetAllGetAddrinfoOSErrors()); | 700 GetAllGetAddrinfoOSErrors()); |
| 674 } | 701 } |
| 675 DCHECK_LT(category, static_cast<int>(RESOLVE_MAX)); // Be sure it was set. | 702 DCHECK_LT(category, static_cast<int>(RESOLVE_MAX)); // Be sure it was set. |
| 676 | 703 |
| 677 UMA_HISTOGRAM_ENUMERATION("DNS.ResolveCategory", category, RESOLVE_MAX); | 704 UMA_HISTOGRAM_ENUMERATION("DNS.ResolveCategory", category, RESOLVE_MAX); |
| 678 | 705 |
| 679 static const bool show_speculative_experiment_histograms = | 706 static const bool show_speculative_experiment_histograms = |
| 680 base::FieldTrialList::TrialExists("DnsImpact"); | 707 base::FieldTrialList::TrialExists("DnsImpact"); |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1605 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; | 1632 additional_resolver_flags_ |= HOST_RESOLVER_LOOPBACK_ONLY; |
| 1606 } else { | 1633 } else { |
| 1607 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY; | 1634 additional_resolver_flags_ &= ~HOST_RESOLVER_LOOPBACK_ONLY; |
| 1608 } | 1635 } |
| 1609 #endif | 1636 #endif |
| 1610 AbortAllInProgressJobs(); | 1637 AbortAllInProgressJobs(); |
| 1611 // |this| may be deleted inside AbortAllInProgressJobs(). | 1638 // |this| may be deleted inside AbortAllInProgressJobs(). |
| 1612 } | 1639 } |
| 1613 | 1640 |
| 1614 } // namespace net | 1641 } // namespace net |
| OLD | NEW |