Chromium Code Reviews| Index: net/base/network_quality.h |
| diff --git a/net/base/network_quality.h b/net/base/network_quality.h |
| index 4e2985776e0f4a8430b80c7523751391b4b0c0b7..a6f42dc370abb3ea2fe86dd6823256450fcd250a 100644 |
| --- a/net/base/network_quality.h |
| +++ b/net/base/network_quality.h |
| @@ -9,41 +9,62 @@ |
| #include "base/time/time.h" |
| +namespace { |
| + |
| +// If two double values are within |kDelta| of each other, they are assumed to |
| +// be equal. |
| +const double kDelta = 0.001; |
| + |
| +} // namespace |
| + |
| namespace net { |
| // API that is used to report the current network quality as estimated by the |
| // NetworkQualityEstimator. |
| +// |rtt| is the estimate of the round trip time for the current connection. |
| +// |rtt_confidence| is the confidence of the |rtt| estimate. |
| +// |throughput_kbps| is the estimate of the Kbps for the current connection. |
| +// |throughput_kbps_confidence| is the confidence of the |throughput_kbps| |
| +// estimate. |
| struct NET_EXPORT_PRIVATE NetworkQuality { |
| - NetworkQuality(const base::TimeDelta& fastest_rtt, |
| - double fastest_rtt_confidence, |
| - uint64_t peak_throughput_kbps, |
| - double peak_throughput_kbps_confidence) |
| - : fastest_rtt(fastest_rtt), |
| - fastest_rtt_confidence(fastest_rtt_confidence), |
| - peak_throughput_kbps(peak_throughput_kbps), |
| - peak_throughput_kbps_confidence(peak_throughput_kbps_confidence) {} |
| + NetworkQuality(const base::TimeDelta& rtt, |
| + double rtt_confidence, |
| + uint64_t throughput_kbps, |
| + double throughput_kbps_confidence) |
| + : rtt(rtt), |
| + rtt_confidence(rtt_confidence), |
| + throughput_kbps(throughput_kbps), |
| + throughput_kbps_confidence(throughput_kbps_confidence) { |
| + DCHECK_GE(rtt, base::TimeDelta()); |
| + DCHECK_GE(rtt_confidence, 0 - kDelta); |
| + DCHECK_LE(rtt_confidence, 1 + kDelta); |
| + |
| + DCHECK_GE(throughput_kbps, 0U); |
| + DCHECK_GE(throughput_kbps_confidence, 0 - kDelta); |
| + DCHECK_LE(throughput_kbps_confidence, 1 + kDelta); |
|
mmenke
2015/06/03 18:31:39
Need base/logging.h (Which is weird to include in
tbansal1
2015/06/05 01:50:08
Done.
|
| + } |
|
mmenke
2015/06/03 18:31:39
De-inline this constructor. Inline constructors s
tbansal1
2015/06/05 01:50:08
Done.
|
| ~NetworkQuality() {} |
| - // The fastest round trip time observed for the current connection. |
| - const base::TimeDelta fastest_rtt; |
| + // The round trip time observed for the current connection. |
| + const base::TimeDelta rtt; |
| - // Confidence of the |fastest_rtt| estimate. Value lies between 0.0 and 1.0 |
| + // Confidence of the |rtt| estimate. Value lies between 0.0 and 1.0 |
| // with 0.0 being no confidence and 1.0 implying that estimates are same as |
| // ground truth. |
| // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are |
| // meaningful. |
| - const double fastest_rtt_confidence; |
| + const double rtt_confidence; |
| - // Peak throughput in Kbps observed for the current connection. |
| - const uint64_t peak_throughput_kbps; |
| + // Throughput in Kbps observed for the current connection. |
| + const uint64_t throughput_kbps; |
| - // Confidence of the |peak_throughput_kbps| estimate. Value lies between 0.0 |
| + // Confidence of the |throughput_kbps| estimate. Value lies between 0.0 |
| // and 1.0 with 0.0 being no confidence and 1.0 implying that estimates are |
| // same as ground truth. |
| // TODO(tbansal): Define units so values intermediate between 0.0 and 1.0 are |
| // meaningful. |
| - const double peak_throughput_kbps_confidence; |
| + const double throughput_kbps_confidence; |
| }; |
| } // namespace net |