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

Unified Diff: third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp

Issue 2929703003: NetInfo: Slight update to the default network quality value (Closed)
Patch Set: Created 3 years, 6 months 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 | « content/test/data/net_info.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp
diff --git a/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp b/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp
index 816d4188e469da17c9b99018155c72d8e5af91fe..32741c1349f95db67a25804c0912c68d7f4d009d 100644
--- a/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp
+++ b/third_party/WebKit/Source/modules/netinfo/NetworkInformation.cpp
@@ -77,13 +77,15 @@ unsigned long RoundRtt(const Optional<TimeDelta>& rtt) {
// Rounds |downlink_mbps| to the nearest 25 kbps as per the NetInfo spec. The
// returned value is in Mbps.
double RoundMbps(const Optional<double>& downlink_mbps) {
+ double downlink_kbps = 0;
if (!downlink_mbps.has_value()) {
// Throughput is unavailable. So, return the fastest value.
- return std::numeric_limits<double>::infinity();
+ downlink_kbps = (std::numeric_limits<double>::max());
+ } else {
+ downlink_kbps = downlink_mbps.value() * 1000;
}
- DCHECK_LE(0, downlink_mbps.value());
- double downlink_kbps = downlink_mbps.value() * 1000;
+ DCHECK_LE(0, downlink_kbps);
double downlink_kbps_rounded = std::round(downlink_kbps / 25) * 25;
return downlink_kbps_rounded / 1000;
}
« no previous file with comments | « content/test/data/net_info.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698