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

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

Issue 2912013002: NetInfo: Slight update to the default network quality value (Closed)
Patch Set: jkarlin comments Created 3 years, 7 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
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 73a679425674ac7aa8211eaaacc921a6653c72ed..35f0a2022f5cf1a1cde1a65877db5a2c43dd2480 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());
nasko 2017/06/01 22:16:13 nit: No need for () around std::numeric?
+ } 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;
}
« content/browser/net_info_browsertest.cc ('K') | « content/browser/net_info_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698