Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2164)

Unified Diff: net/base/network_change_notifier.cc

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/base/upload_bytes_element_reader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier.cc
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index afd6b23d4fa2a0646ef30086ddfea1a86a0c5117..b797864ac80f4a74833247f97ebf97ce0a3cc89a 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -305,7 +305,8 @@ class HistogramWatcher
if (bytes_read > 10000 &&
request_duration > base::TimeDelta::FromMilliseconds(1) &&
request.creation_time() > last_connection_change_) {
- int32 kbps = bytes_read * 8 / request_duration.InMilliseconds();
+ int32 kbps = static_cast<int32>(
+ bytes_read * 8 / request_duration.InMilliseconds());
if (kbps > peak_kbps_since_last_connection_change_)
peak_kbps_since_last_connection_change_ = kbps;
}
@@ -784,6 +785,81 @@ double NetworkChangeNotifier::GetCurrentMaxBandwidth() const {
}
// static
+double NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype(
+ ConnectionSubtype subtype) {
+ switch (subtype) {
+ case SUBTYPE_GSM:
+ return 0.01;
+ case SUBTYPE_IDEN:
+ return 0.064;
+ case SUBTYPE_CDMA:
+ return 0.115;
+ case SUBTYPE_1XRTT:
+ return 0.153;
+ case SUBTYPE_GPRS:
+ return 0.237;
+ case SUBTYPE_EDGE:
+ return 0.384;
+ case SUBTYPE_UMTS:
+ return 2.0;
+ case SUBTYPE_EVDO_REV_0:
+ return 2.46;
+ case SUBTYPE_EVDO_REV_A:
+ return 3.1;
+ case SUBTYPE_HSPA:
+ return 3.6;
+ case SUBTYPE_EVDO_REV_B:
+ return 14.7;
+ case SUBTYPE_HSDPA:
+ return 14.3;
+ case SUBTYPE_HSUPA:
+ return 14.4;
+ case SUBTYPE_EHRPD:
+ return 21.0;
+ case SUBTYPE_HSPAP:
+ return 42.0;
+ case SUBTYPE_LTE:
+ return 100.0;
+ case SUBTYPE_LTE_ADVANCED:
+ return 100.0;
+ case SUBTYPE_BLUETOOTH_1_2:
+ return 1.0;
+ case SUBTYPE_BLUETOOTH_2_1:
+ return 3.0;
+ case SUBTYPE_BLUETOOTH_3_0:
+ return 24.0;
+ case SUBTYPE_BLUETOOTH_4_0:
+ return 1.0;
+ case SUBTYPE_ETHERNET:
+ return 10.0;
+ case SUBTYPE_FAST_ETHERNET:
+ return 100.0;
+ case SUBTYPE_GIGABIT_ETHERNET:
+ return 1000.0;
+ case SUBTYPE_10_GIGABIT_ETHERNET:
+ return 10000.0;
+ case SUBTYPE_WIFI_B:
+ return 11.0;
+ case SUBTYPE_WIFI_G:
+ return 54.0;
+ case SUBTYPE_WIFI_N:
+ return 600.0;
+ case SUBTYPE_WIFI_AC:
+ return 1300.0;
+ case SUBTYPE_WIFI_AD:
+ return 7000.0;
+ case SUBTYPE_UNKNOWN:
+ return std::numeric_limits<double>::infinity();
+ case SUBTYPE_NONE:
+ return 0.0;
+ case SUBTYPE_OTHER:
+ return std::numeric_limits<double>::infinity();
+ }
+ NOTREACHED();
+ return std::numeric_limits<double>::infinity();
+}
+
+// static
void NetworkChangeNotifier::NotifyObserversOfIPAddressChange() {
if (g_network_change_notifier &&
!g_network_change_notifier->test_notifications_only_) {
« no previous file with comments | « net/base/network_change_notifier.h ('k') | net/base/upload_bytes_element_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698