summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorisherman <isherman@chromium.org>2015-04-24 14:50:24 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-24 21:51:24 +0000
commit720823c1a3a190140c34875577af67c63abdd6e8 (patch)
treef665604523a0b0eb65d1daa6679a64e7bf5a2817
parent9bbf3290520788bfe634a286a30965cd43f4dd78 (diff)
downloadchromium_src-720823c1a3a190140c34875577af67c63abdd6e8.zip
chromium_src-720823c1a3a190140c34875577af67c63abdd6e8.tar.gz
chromium_src-720823c1a3a190140c34875577af67c63abdd6e8.tar.bz2
[Metrics, Cleanup] Replace a misleading TODO with documentation.
BUG=none TEST=none R=asvitkine@chromium.org Review URL: https://codereview.chromium.org/1107613003 Cr-Commit-Position: refs/heads/master@{#326887}
-rw-r--r--components/metrics/net/network_metrics_provider.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/components/metrics/net/network_metrics_provider.cc b/components/metrics/net/network_metrics_provider.cc
index e845cde..954df23 100644
--- a/components/metrics/net/network_metrics_provider.cc
+++ b/components/metrics/net/network_metrics_provider.cc
@@ -49,10 +49,13 @@ void NetworkMetricsProvider::ProvideSystemProfileMetrics(
wifi_phy_layer_protocol_is_ambiguous_);
network->set_wifi_phy_layer_protocol(GetWifiPHYLayerProtocol());
- // Resets the "ambiguous" flags, since a new metrics log session has started.
- connection_type_is_ambiguous_ = false;
- // TODO(isherman): This line seems unnecessary.
+ // Update the connection type. Note that this is necessary to set the network
+ // type to "none" if there is no network connection for an entire UMA logging
+ // window, since OnConnectionTypeChanged() ignores transitions to the "none"
+ // state.
connection_type_ = net::NetworkChangeNotifier::GetConnectionType();
+ // Reset the "ambiguous" flags, since a new metrics log session has started.
+ connection_type_is_ambiguous_ = false;
wifi_phy_layer_protocol_is_ambiguous_ = false;
if (!wifi_access_point_info_provider_.get()) {
@@ -73,8 +76,15 @@ void NetworkMetricsProvider::ProvideSystemProfileMetrics(
void NetworkMetricsProvider::OnConnectionTypeChanged(
net::NetworkChangeNotifier::ConnectionType type) {
+ // To avoid reporting an ambiguous connection type for users on flaky
+ // connections, ignore transitions to the "none" state. Note that the
+ // connection type is refreshed in ProvideSystemProfileMetrics() each time a
+ // new UMA logging window begins, so users who genuinely transition to offline
+ // mode for an extended duration will still be at least partially represented
+ // in the metrics logs.
if (type == net::NetworkChangeNotifier::CONNECTION_NONE)
return;
+
if (type != connection_type_ &&
connection_type_ != net::NetworkChangeNotifier::CONNECTION_NONE) {
connection_type_is_ambiguous_ = true;