OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/nqe/network_quality_estimator.h" | 5 #include "net/nqe/network_quality_estimator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <utility> | 10 #include <utility> |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1184 NetworkQualityEstimator::MetricUsage downstream_throughput_kbps_metric, | 1184 NetworkQualityEstimator::MetricUsage downstream_throughput_kbps_metric, |
1185 base::TimeDelta* http_rtt, | 1185 base::TimeDelta* http_rtt, |
1186 base::TimeDelta* transport_rtt, | 1186 base::TimeDelta* transport_rtt, |
1187 int32_t* downstream_throughput_kbps) const { | 1187 int32_t* downstream_throughput_kbps) const { |
1188 DCHECK(thread_checker_.CalledOnValidThread()); | 1188 DCHECK(thread_checker_.CalledOnValidThread()); |
1189 | 1189 |
1190 *http_rtt = nqe::internal::InvalidRTT(); | 1190 *http_rtt = nqe::internal::InvalidRTT(); |
1191 *transport_rtt = nqe::internal::InvalidRTT(); | 1191 *transport_rtt = nqe::internal::InvalidRTT(); |
1192 *downstream_throughput_kbps = nqe::internal::kInvalidThroughput; | 1192 *downstream_throughput_kbps = nqe::internal::kInvalidThroughput; |
1193 | 1193 |
1194 if (params_.forced_effective_connection_type()) | 1194 if (params_.forced_effective_connection_type()) { |
| 1195 *http_rtt = params_ |
| 1196 .TypicalNetworkQuality( |
| 1197 params_.forced_effective_connection_type().value()) |
| 1198 .http_rtt(); |
| 1199 *transport_rtt = params_ |
| 1200 .TypicalNetworkQuality( |
| 1201 params_.forced_effective_connection_type().value()) |
| 1202 .transport_rtt(); |
| 1203 *downstream_throughput_kbps = |
| 1204 params_ |
| 1205 .TypicalNetworkQuality( |
| 1206 params_.forced_effective_connection_type().value()) |
| 1207 .downstream_throughput_kbps(); |
1195 return params_.forced_effective_connection_type().value(); | 1208 return params_.forced_effective_connection_type().value(); |
| 1209 } |
1196 | 1210 |
1197 // If the device is currently offline, then return | 1211 // If the device is currently offline, then return |
1198 // EFFECTIVE_CONNECTION_TYPE_OFFLINE. | 1212 // EFFECTIVE_CONNECTION_TYPE_OFFLINE. |
1199 | 1213 |
1200 if (current_network_id_.type == NetworkChangeNotifier::CONNECTION_NONE && | 1214 if (current_network_id_.type == NetworkChangeNotifier::CONNECTION_NONE && |
1201 !disable_offline_check_) { | 1215 !disable_offline_check_) { |
1202 return EFFECTIVE_CONNECTION_TYPE_OFFLINE; | 1216 return EFFECTIVE_CONNECTION_TYPE_OFFLINE; |
1203 } | 1217 } |
1204 | 1218 |
1205 if (!GetRecentHttpRTT(start_time, http_rtt)) | 1219 if (!GetRecentHttpRTT(start_time, http_rtt)) |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 return base::Optional<base::TimeDelta>(); | 1833 return base::Optional<base::TimeDelta>(); |
1820 } | 1834 } |
1821 | 1835 |
1822 base::Optional<int32_t> | 1836 base::Optional<int32_t> |
1823 NetworkQualityEstimator::NetworkQualityProvider::GetDownstreamThroughputKbps() | 1837 NetworkQualityEstimator::NetworkQualityProvider::GetDownstreamThroughputKbps() |
1824 const { | 1838 const { |
1825 return base::Optional<int32_t>(); | 1839 return base::Optional<int32_t>(); |
1826 } | 1840 } |
1827 | 1841 |
1828 } // namespace net | 1842 } // namespace net |
OLD | NEW |