diff options
author | jkarlin@chromium.org <jkarlin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-04 14:08:40 +0000 |
---|---|---|
committer | jkarlin@chromium.org <jkarlin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-04 14:08:40 +0000 |
commit | 078cab2e42fdb14b877917b33dad3290f493a24d (patch) | |
tree | 5d30b318baf3745e3091ba47f80c2e906c8548ad | |
parent | edf38edb6712d24baf6df6230dd4b6990c4ddc03 (diff) | |
download | chromium_src-078cab2e42fdb14b877917b33dad3290f493a24d.zip chromium_src-078cab2e42fdb14b877917b33dad3290f493a24d.tar.gz chromium_src-078cab2e42fdb14b877917b33dad3290f493a24d.tar.bz2 |
Adds bluetooth connection type to NetworkChangeNotifier.
This is for compliance with NetInfov3 (http://w3c.github.io/netinfo/).
BUG=378785
Review URL: https://codereview.chromium.org/307943004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274817 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/extensions/api/dial/dial_registry.cc | 1 | ||||
-rw-r--r-- | chrome/browser/metrics/network_metrics_provider.cc | 2 | ||||
-rw-r--r-- | components/metrics/proto/system_profile.proto | 1 | ||||
-rw-r--r-- | content/renderer/net_info_helper.cc | 2 | ||||
-rw-r--r-- | net/base/network_change_notifier.cc | 21 | ||||
-rw-r--r-- | net/base/network_change_notifier.h | 7 | ||||
-rw-r--r-- | net/tools/net_watcher/net_watcher.cc | 2 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 3 |
8 files changed, 33 insertions, 6 deletions
diff --git a/chrome/browser/extensions/api/dial/dial_registry.cc b/chrome/browser/extensions/api/dial/dial_registry.cc index 66d88b4..198a0b8 100644 --- a/chrome/browser/extensions/api/dial/dial_registry.cc +++ b/chrome/browser/extensions/api/dial/dial_registry.cc @@ -319,6 +319,7 @@ void DialRegistry::OnNetworkChanged( case NetworkChangeNotifier::CONNECTION_ETHERNET: case NetworkChangeNotifier::CONNECTION_WIFI: case NetworkChangeNotifier::CONNECTION_UNKNOWN: + case NetworkChangeNotifier::CONNECTION_BLUETOOTH: if (!dial_.get()) { VLOG(2) << "Connection detected, restarting discovery."; StartPeriodicDiscovery(); diff --git a/chrome/browser/metrics/network_metrics_provider.cc b/chrome/browser/metrics/network_metrics_provider.cc index 006e1a7..b339d4b 100644 --- a/chrome/browser/metrics/network_metrics_provider.cc +++ b/chrome/browser/metrics/network_metrics_provider.cc @@ -70,6 +70,8 @@ NetworkMetricsProvider::GetConnectionType() const { return SystemProfileProto::Network::CONNECTION_3G; case net::NetworkChangeNotifier::CONNECTION_4G: return SystemProfileProto::Network::CONNECTION_4G; + case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: + return SystemProfileProto::Network::CONNECTION_BLUETOOTH; } NOTREACHED(); return SystemProfileProto::Network::CONNECTION_UNKNOWN; diff --git a/components/metrics/proto/system_profile.proto b/components/metrics/proto/system_profile.proto index 98a0f5d..1145333 100644 --- a/components/metrics/proto/system_profile.proto +++ b/components/metrics/proto/system_profile.proto @@ -268,6 +268,7 @@ message SystemProfileProto { CONNECTION_2G = 3; CONNECTION_3G = 4; CONNECTION_4G = 5; + CONNECTION_BLUETOOTH = 6; } // The connection type according to NetworkChangeNotifier. optional ConnectionType connection_type = 2; diff --git a/content/renderer/net_info_helper.cc b/content/renderer/net_info_helper.cc index 8e0d651..a833368 100644 --- a/content/renderer/net_info_helper.cc +++ b/content/renderer/net_info_helper.cc @@ -22,6 +22,8 @@ NetConnectionTypeToWebConnectionType( case net::NetworkChangeNotifier::CONNECTION_3G: case net::NetworkChangeNotifier::CONNECTION_4G: return blink::ConnectionTypeCellular; + case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: + return blink::ConnectionTypeBluetooth; } NOTREACHED(); diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc index aef8356..c55be07 100644 --- a/net/base/network_change_notifier.cc +++ b/net/base/network_change_notifier.cc @@ -151,6 +151,11 @@ class HistogramWatcher UMA_HISTOGRAM_TIMES("NCN.CM.FastestRTTOnNone", fastest_RTT_since_last_connection_change_); break; + case NetworkChangeNotifier::CONNECTION_BLUETOOTH: + UMA_HISTOGRAM_TIMES("NCN.CM.FirstReadOnBluetooth", + first_byte_after_connection_change_); + UMA_HISTOGRAM_TIMES("NCN.CM.FastestRTTOnBluetooth", + fastest_RTT_since_last_connection_change_); } } if (peak_kbps_since_last_connection_change_) { @@ -183,6 +188,10 @@ class HistogramWatcher UMA_HISTOGRAM_COUNTS("NCN.CM.PeakKbpsOnNone", peak_kbps_since_last_connection_change_); break; + case NetworkChangeNotifier::CONNECTION_BLUETOOTH: + UMA_HISTOGRAM_COUNTS("NCN.CM.PeakKbpsOnBluetooth", + peak_kbps_since_last_connection_change_); + break; } } switch (last_connection_type_) { @@ -214,6 +223,10 @@ class HistogramWatcher UMA_HISTOGRAM_LONG_TIMES("NCN.CM.TimeOnNone", state_duration); UMA_HISTOGRAM_COUNTS("NCN.CM.KBTransferedOnNone", kilobytes_read); break; + case NetworkChangeNotifier::CONNECTION_BLUETOOTH: + UMA_HISTOGRAM_LONG_TIMES("NCN.CM.TimeOnBluetooth", state_duration); + UMA_HISTOGRAM_COUNTS("NCN.CM.KBTransferedOnBluetooth", kilobytes_read); + break; } if (type != NetworkChangeNotifier::CONNECTION_NONE) { @@ -540,13 +553,14 @@ const char* NetworkChangeNotifier::ConnectionTypeToString( "CONNECTION_2G", "CONNECTION_3G", "CONNECTION_4G", - "CONNECTION_NONE" + "CONNECTION_NONE", + "CONNECTION_BLUETOOTH" }; COMPILE_ASSERT( arraysize(kConnectionTypeNames) == - NetworkChangeNotifier::CONNECTION_NONE + 1, + NetworkChangeNotifier::CONNECTION_LAST + 1, ConnectionType_name_count_mismatch); - if (type < CONNECTION_UNKNOWN || type > CONNECTION_NONE) { + if (type < CONNECTION_UNKNOWN || type > CONNECTION_LAST) { NOTREACHED(); return "CONNECTION_INVALID"; } @@ -625,6 +639,7 @@ bool NetworkChangeNotifier::IsConnectionCellular(ConnectionType type) { case CONNECTION_ETHERNET: case CONNECTION_WIFI: case CONNECTION_NONE: + case CONNECTION_BLUETOOTH: is_cellular = false; break; } diff --git a/net/base/network_change_notifier.h b/net/base/network_change_notifier.h index 4671e49..6b801bc 100644 --- a/net/base/network_change_notifier.h +++ b/net/base/network_change_notifier.h @@ -32,8 +32,8 @@ class AddressTrackerLinux; // destroyed on the same thread. class NET_EXPORT NetworkChangeNotifier { public: - // Using the terminology of the Network Information API: - // http://www.w3.org/TR/netinfo-api. + // This is a superset of the connection types in the NetInfo v3 specification: + // http://w3c.github.io/netinfo/. enum ConnectionType { CONNECTION_UNKNOWN = 0, // A connection exists, but its type is unknown. // Also used as a default value. @@ -43,7 +43,8 @@ class NET_EXPORT NetworkChangeNotifier { CONNECTION_3G = 4, CONNECTION_4G = 5, CONNECTION_NONE = 6, // No connection. - CONNECTION_LAST = CONNECTION_NONE + CONNECTION_BLUETOOTH = 7, + CONNECTION_LAST = CONNECTION_BLUETOOTH }; class NET_EXPORT IPAddressObserver { diff --git a/net/tools/net_watcher/net_watcher.cc b/net/tools/net_watcher/net_watcher.cc index f0e7e1e..421e695 100644 --- a/net/tools/net_watcher/net_watcher.cc +++ b/net/tools/net_watcher/net_watcher.cc @@ -50,6 +50,8 @@ const char* ConnectionTypeToString( return "CONNECTION_4G"; case net::NetworkChangeNotifier::CONNECTION_NONE: return "CONNECTION_NONE"; + case net::NetworkChangeNotifier::CONNECTION_BLUETOOTH: + return "CONNECTION_BLUETOOTH"; default: return "CONNECTION_UNEXPECTED"; } diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 3eece60..87e6d1a 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -45813,6 +45813,9 @@ Therefore, the affected-histogram name has to have at least one dot in it. <suffix name="CONNECTION_4G" label="mobile 4G are tallied."/> <suffix name="CONNECTION_NONE" label="NO(?) network are tallied (should be empty)."/> + <suffix name="CONNECTION_BLUETOOTH" + label="Bluetooth are tallied, but this may include connections to a + mobile hotspot."/> <affected-histogram name="Net.QuicSession.21CumulativePacketsReceived_First21"/> <affected-histogram |