Index: chrome/browser/net/dns_probe_service.cc |
diff --git a/chrome/browser/net/dns_probe_service.cc b/chrome/browser/net/dns_probe_service.cc |
index 8a0e9f073e973e6581e7c11a1924c5d5760cf34c..54e6c4cbc76d6bf013e9d5d75d18e510ce1c9cf7 100644 |
--- a/chrome/browser/net/dns_probe_service.cc |
+++ b/chrome/browser/net/dns_probe_service.cc |
@@ -17,7 +17,7 @@ |
using base::FieldTrialList; |
using base::StringToInt; |
-using chrome_common_net::DnsProbeResult; |
+using chrome_common_net::DnsProbeStatus; |
using net::DnsClient; |
using net::DnsConfig; |
using net::IPAddressNumber; |
@@ -76,7 +76,7 @@ DnsProbeService::DnsProbeService() |
: system_result_(DnsProbeJob::SERVERS_UNKNOWN), |
public_result_(DnsProbeJob::SERVERS_UNKNOWN), |
state_(STATE_NO_RESULTS), |
- result_(chrome_common_net::DNS_PROBE_UNKNOWN), |
+ result_(chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN), |
dns_attempts_(GetAttemptsFromFieldTrial()) { |
NetworkChangeNotifier::AddIPAddressObserver(this); |
} |
@@ -127,7 +127,7 @@ void DnsProbeService::ExpireResults() { |
DCHECK_EQ(STATE_RESULTS_CACHED, state_); |
state_ = STATE_NO_RESULTS; |
- result_ = chrome_common_net::DNS_PROBE_UNKNOWN; |
+ result_ = chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN; |
mmenke
2013/04/10 16:56:58
Should this actually be DNS_PROBE_MAX? Seems like
Deprecated (see juliatuttle)
2013/04/10 23:42:32
Done.
|
} |
void DnsProbeService::StartProbes() { |
@@ -154,7 +154,7 @@ void DnsProbeService::StartProbes() { |
state_ = STATE_RESULTS_CACHED; |
// TODO(ttuttle): Should this be BAD_CONFIG? Currently I think it only |
// happens when the system DnsConfig has no servers. |
- result_ = chrome_common_net::DNS_PROBE_UNKNOWN; |
+ result_ = chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN; |
CallCallbacks(); |
return; |
} |
@@ -175,87 +175,82 @@ void DnsProbeService::OnProbesComplete() { |
} |
void DnsProbeService::HistogramProbes() const { |
- const DnsProbeResult kMaxResult = chrome_common_net::DNS_PROBE_MAX; |
+ const DnsProbeStatus kMinFinishedStatus = |
+ chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN; |
+ const DnsProbeStatus kMaxStatus = chrome_common_net::DNS_PROBE_MAX; |
DCHECK_EQ(STATE_RESULTS_CACHED, state_); |
- DCHECK_NE(kMaxResult, result_); |
+ DCHECK_GE(result_, kMinFinishedStatus); |
+ DCHECK_NE(result_, kMaxStatus); |
mmenke
2013/04/10 16:56:58
DCHECK_LT?
Deprecated (see juliatuttle)
2013/04/10 23:42:32
Done.
|
base::TimeDelta elapsed = base::Time::Now() - probe_start_time_; |
- UMA_HISTOGRAM_ENUMERATION("DnsProbe.Probe.Result", result_, kMaxResult); |
- UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Probe.Elapsed", elapsed); |
+ UMA_HISTOGRAM_ENUMERATION("DnsProbe.Status", result_, kMaxStatus); |
+ UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Elapsed", elapsed); |
if (NetworkChangeNotifier::IsOffline()) { |
- UMA_HISTOGRAM_ENUMERATION("DnsProbe.Probe.NcnOffline.Result", |
- result_, kMaxResult); |
- UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Probe.NcnOffline.Elapsed", elapsed); |
+ UMA_HISTOGRAM_ENUMERATION("DnsProbe.Status_NcnOffline", |
+ result_, kMaxStatus); |
+ UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Elapsed_NcnOffline", elapsed); |
} else { |
- UMA_HISTOGRAM_ENUMERATION("DnsProbe.Probe.NcnOnline.Result", |
- result_, kMaxResult); |
- UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Probe.NcnOnline.Elapsed", elapsed); |
+ UMA_HISTOGRAM_ENUMERATION("DnsProbe.Status_NcnOnline", |
+ result_, kMaxStatus); |
+ UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Elapsed_NcnOnline", elapsed); |
} |
switch (result_) { |
- case chrome_common_net::DNS_PROBE_UNKNOWN: |
- UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Probe.ResultUnknown.Elapsed", |
+ case chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN: |
+ UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Elapsed_Unknown", |
elapsed); |
break; |
- case chrome_common_net::DNS_PROBE_NO_INTERNET: |
- UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Probe.ResultNoInternet.Elapsed", |
+ case chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET: |
+ UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Elapsed_NoInternet", |
elapsed); |
break; |
- case chrome_common_net::DNS_PROBE_BAD_CONFIG: |
- UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Probe.ResultBadConfig.Elapsed", |
+ case chrome_common_net::DNS_PROBE_FINISHED_BAD_CONFIG: |
+ UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Elapsed_BadConfig", |
elapsed); |
- |
- // Histogram some extra data to see why BAD_CONFIG is happening. |
- UMA_HISTOGRAM_ENUMERATION( |
- "DnsProbe.Probe.ResultBadConfig.SystemJobResult", |
- system_result_, |
- DnsProbeJob::MAX_RESULT); |
- UMA_HISTOGRAM_CUSTOM_COUNTS( |
- "DnsProbe.Probe.ResultBadConfig.SystemNameserverCount", |
- system_nameserver_count_, |
- 0, kNameserverCountMax, kNameserverCountMax + 1); |
- UMA_HISTOGRAM_BOOLEAN( |
- "DnsProbe.Probe.ResultBadConfig.SystemIsLocalhost", |
- system_is_localhost_); |
break; |
- case chrome_common_net::DNS_PROBE_NXDOMAIN: |
- UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Probe.ResultNxdomain.Elapsed", |
+ case chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN: |
+ UMA_HISTOGRAM_MEDIUM_TIMES("DnsProbe.Elapsed_Nxdomain", |
elapsed); |
break; |
+ |
+ // These aren't actually results. |
+ case chrome_common_net::DNS_PROBE_POSSIBLE: |
+ case chrome_common_net::DNS_PROBE_NOT_RUN: |
+ case chrome_common_net::DNS_PROBE_STARTED: |
case chrome_common_net::DNS_PROBE_MAX: |
mmenke
2013/04/10 16:56:58
Maybe just a "default:"?
Deprecated (see juliatuttle)
2013/04/10 23:42:32
I didn't use default: to preserve the warning if w
|
NOTREACHED(); |
break; |
} |
} |
-DnsProbeResult DnsProbeService::EvaluateResults() const { |
+DnsProbeStatus DnsProbeService::EvaluateResults() const { |
DCHECK_NE(DnsProbeJob::SERVERS_UNKNOWN, system_result_); |
DCHECK_NE(DnsProbeJob::SERVERS_UNKNOWN, public_result_); |
// If the system DNS is working, assume the domain doesn't exist. |
if (system_result_ == DnsProbeJob::SERVERS_CORRECT) |
- return chrome_common_net::DNS_PROBE_NXDOMAIN; |
+ return chrome_common_net::DNS_PROBE_FINISHED_NXDOMAIN; |
// If the system DNS is not working but another public server is, assume the |
// DNS config is bad (or perhaps the DNS servers are down or broken). |
if (public_result_ == DnsProbeJob::SERVERS_CORRECT) |
- return chrome_common_net::DNS_PROBE_BAD_CONFIG; |
+ return chrome_common_net::DNS_PROBE_FINISHED_BAD_CONFIG; |
// If the system DNS is not working and another public server is unreachable, |
// assume the internet connection is down (note that system DNS may be a |
// router on the LAN, so it may be reachable but returning errors.) |
if (public_result_ == DnsProbeJob::SERVERS_UNREACHABLE) |
- return chrome_common_net::DNS_PROBE_NO_INTERNET; |
+ return chrome_common_net::DNS_PROBE_FINISHED_NO_INTERNET; |
// Otherwise: the system DNS is not working and another public server is |
// responding but with errors or incorrect results. This is an awkward case; |
// an invasive captive portal or a restrictive firewall may be intercepting |
// or rewriting DNS traffic, or the public server may itself be failing or |
// down. |
- return chrome_common_net::DNS_PROBE_UNKNOWN; |
+ return chrome_common_net::DNS_PROBE_FINISHED_UNKNOWN; |
} |
void DnsProbeService::CallCallbacks() { |
@@ -312,12 +307,6 @@ void DnsProbeService::GetSystemDnsConfig(DnsConfig* config) { |
if (dns_attempts_ != kAttemptsUseDefault) |
config->attempts = dns_attempts_; |
- // Take notes in case the config turns out to be bad, so we can histogram |
- // some useful data. |
- system_nameserver_count_ = config->nameservers.size(); |
- system_is_localhost_ = (system_nameserver_count_ == 1) |
- && IsLocalhost(config->nameservers[0].address()); |
- |
// Disable port randomization. |
config->randomize_ports = false; |
} |