| 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/base/network_quality_estimator.h" | 5 #include "net/base/network_quality_estimator.h" |
| 6 | 6 |
| 7 #include <float.h> | 7 #include <float.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 // updates estimates are available, OnUpdatedEstimateAvailable() will be | 1082 // updates estimates are available, OnUpdatedEstimateAvailable() will be |
| 1083 // called. | 1083 // called. |
| 1084 external_estimate_provider_->Update(); | 1084 external_estimate_provider_->Update(); |
| 1085 return; | 1085 return; |
| 1086 } | 1086 } |
| 1087 | 1087 |
| 1088 RecordExternalEstimateProviderMetrics( | 1088 RecordExternalEstimateProviderMetrics( |
| 1089 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL); | 1089 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL); |
| 1090 base::TimeDelta rtt; | 1090 base::TimeDelta rtt; |
| 1091 if (external_estimate_provider_->GetRTT(&rtt)) { | 1091 if (external_estimate_provider_->GetRTT(&rtt)) { |
| 1092 RecordExternalEstimateProviderMetrics( |
| 1093 EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE); |
| 1094 UMA_HISTOGRAM_TIMES("NQE.ExternalEstimateProvider.RTT", rtt); |
| 1092 rtt_observations_.AddObservation( | 1095 rtt_observations_.AddObservation( |
| 1093 RttObservation(rtt, base::TimeTicks::Now(), EXTERNAL_ESTIMATE)); | 1096 RttObservation(rtt, base::TimeTicks::Now(), EXTERNAL_ESTIMATE)); |
| 1094 } | 1097 } |
| 1095 | 1098 |
| 1096 int32_t downstream_throughput_kbps; | 1099 int32_t downstream_throughput_kbps; |
| 1097 if (external_estimate_provider_->GetDownstreamThroughputKbps( | 1100 if (external_estimate_provider_->GetDownstreamThroughputKbps( |
| 1098 &downstream_throughput_kbps)) { | 1101 &downstream_throughput_kbps)) { |
| 1102 RecordExternalEstimateProviderMetrics( |
| 1103 EXTERNAL_ESTIMATE_PROVIDER_STATUS_DOWNLINK_BANDWIDTH_AVAILABLE); |
| 1104 UMA_HISTOGRAM_COUNTS("NQE.ExternalEstimateProvider.DownlinkBandwidth", |
| 1105 downstream_throughput_kbps); |
| 1099 downstream_throughput_kbps_observations_.AddObservation( | 1106 downstream_throughput_kbps_observations_.AddObservation( |
| 1100 ThroughputObservation(downstream_throughput_kbps, | 1107 ThroughputObservation(downstream_throughput_kbps, |
| 1101 base::TimeTicks::Now(), EXTERNAL_ESTIMATE)); | 1108 base::TimeTicks::Now(), EXTERNAL_ESTIMATE)); |
| 1102 } | 1109 } |
| 1103 } | 1110 } |
| 1104 | 1111 |
| 1105 void NetworkQualityEstimator::CacheNetworkQualityEstimate() { | 1112 void NetworkQualityEstimator::CacheNetworkQualityEstimate() { |
| 1106 DCHECK(thread_checker_.CalledOnValidThread()); | 1113 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1107 DCHECK_LE(cached_network_qualities_.size(), | 1114 DCHECK_LE(cached_network_qualities_.size(), |
| 1108 static_cast<size_t>(kMaximumNetworkQualityCacheSize)); | 1115 static_cast<size_t>(kMaximumNetworkQualityCacheSize)); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1214 | 1221 |
| 1215 NetworkQualityEstimator::NetworkQuality& | 1222 NetworkQualityEstimator::NetworkQuality& |
| 1216 NetworkQualityEstimator::NetworkQuality:: | 1223 NetworkQualityEstimator::NetworkQuality:: |
| 1217 operator=(const NetworkQuality& other) { | 1224 operator=(const NetworkQuality& other) { |
| 1218 rtt_ = other.rtt_; | 1225 rtt_ = other.rtt_; |
| 1219 downstream_throughput_kbps_ = other.downstream_throughput_kbps_; | 1226 downstream_throughput_kbps_ = other.downstream_throughput_kbps_; |
| 1220 return *this; | 1227 return *this; |
| 1221 } | 1228 } |
| 1222 | 1229 |
| 1223 } // namespace net | 1230 } // namespace net |
| OLD | NEW |