| 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 #ifndef NET_BASE_NETWORK_QUALITY_H_ | 5 #ifndef NET_BASE_NETWORK_QUALITY_H_ |
| 6 #define NET_BASE_NETWORK_QUALITY_H_ | 6 #define NET_BASE_NETWORK_QUALITY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 // API that is used to report the current network quality as estimated by the | 14 // API that is used to report the current network quality as estimated by the |
| 15 // NetworkQualityEstimator. | 15 // NetworkQualityEstimator. |
| 16 struct NET_EXPORT_PRIVATE NetworkQuality { | 16 struct NET_EXPORT_PRIVATE NetworkQuality { |
| 17 NetworkQuality(const base::TimeDelta& fastest_rtt, | 17 NetworkQuality(const base::TimeDelta& fastest_rtt, |
| 18 double fastest_rtt_confidence, | 18 double fastest_rtt_confidence, |
| 19 uint64_t peak_throughput_kbps, | 19 uint64_t peak_throughput_kbps, |
| 20 double peak_throughput_kbps_confidence) | 20 double peak_throughput_kbps_confidence) |
| 21 : fastest_rtt(fastest_rtt), | 21 : fastest_rtt(fastest_rtt), |
| 22 fastest_rtt_confidence(fastest_rtt_confidence), | 22 fastest_rtt_confidence(fastest_rtt_confidence), |
| 23 peak_throughput_kbps(peak_throughput_kbps), | 23 peak_throughput_kbps(peak_throughput_kbps), |
| 24 peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {} | 24 peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {} |
| 25 | 25 |
| 26 NetworkQuality(const NetworkQuality& other) |
| 27 : fastest_rtt(other.fastest_rtt), |
| 28 fastest_rtt_confidence(other.fastest_rtt_confidence), |
| 29 peak_throughput_kbps(other.peak_throughput_kbps), |
| 30 peak_throughput_kbps_confidence(other.peak_throughput_kbps_confidence) { |
| 31 } |
| 32 |
| 33 NetworkQuality& operator=(const NetworkQuality& other) { |
| 34 fastest_rtt = other.fastest_rtt; |
| 35 fastest_rtt_confidence = other.fastest_rtt_confidence; |
| 36 peak_throughput_kbps = other.peak_throughput_kbps; |
| 37 peak_throughput_kbps_confidence = other.peak_throughput_kbps_confidence; |
| 38 return *this; |
| 39 } |
| 40 |
| 26 ~NetworkQuality() {} | 41 ~NetworkQuality() {} |
| 27 | 42 |
| 28 // The fastest round trip time observed for the current connection. | 43 // The fastest round trip time observed for the current connection. |
| 29 const base::TimeDelta fastest_rtt; | 44 base::TimeDelta fastest_rtt; |
| 30 | 45 |
| 31 // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0 | 46 // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0 |
| 32 // with 0.0 being no confidence and 1.0 implying that estimates are same as | 47 // with 0.0 being no confidence and 1.0 implying that estimates are same as |
| 33 // ground truth. | 48 // ground truth. |
| 34 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are | 49 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are |
| 35 // meaningful. | 50 // meaningful. |
| 36 const double fastest_rtt_confidence; | 51 double fastest_rtt_confidence; |
| 37 | 52 |
| 38 // Peak throughput in Kbps observed for the current connection. | 53 // Peak throughput in Kbps observed for the current connection. |
| 39 const uint64_t peak_throughput_kbps; | 54 uint64_t peak_throughput_kbps; |
| 40 | 55 |
| 41 // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0 | 56 // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0 |
| 42 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are | 57 // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are |
| 43 // same as ground truth. | 58 // same as ground truth. |
| 44 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are | 59 // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are |
| 45 // meaningful. | 60 // meaningful. |
| 46 const double peak_throughput_kbps_confidence; | 61 double peak_throughput_kbps_confidence; |
| 47 }; | 62 }; |
| 48 | 63 |
| 49 } // namespace net | 64 } // namespace net |
| 50 | 65 |
| 51 #endif // NET_BASE_NETWORK_QUALITY_H_ | 66 #endif // NET_BASE_NETWORK_QUALITY_H_ |
| OLD | NEW |