| Index: net/nqe/network_quality_estimator.h
|
| diff --git a/net/nqe/network_quality_estimator.h b/net/nqe/network_quality_estimator.h
|
| index 102dfa766f16f43cde4fa5b2da8de03932c65708..afeca4eb01e1220879cb01bf87a644ebe06a9775 100644
|
| --- a/net/nqe/network_quality_estimator.h
|
| +++ b/net/nqe/network_quality_estimator.h
|
| @@ -292,17 +292,20 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
| // at the HTTP layer measures the time from when the request was sent (this
|
| // happens after the connection is established) to the time when the response
|
| // headers were received.
|
| + // TODO(tbansal): Change it to return HTTP RTT as base::TimeDelta.
|
| virtual bool GetHttpRTTEstimate(base::TimeDelta* rtt) const
|
| WARN_UNUSED_RESULT;
|
|
|
| // Returns true if the RTT is available and sets |rtt| to the RTT estimated at
|
| // the transport layer. |rtt| should not be null. Virtualized for testing.
|
| + // TODO(tbansal): Change it to return transport RTT as base::TimeDelta.
|
| virtual bool GetTransportRTTEstimate(base::TimeDelta* rtt) const
|
| WARN_UNUSED_RESULT;
|
|
|
| // Returns true if downlink throughput is available and sets |kbps| to
|
| // estimated downlink throughput (in kilobits per second).
|
| // Virtualized for testing. |kbps| should not be null.
|
| + // TODO(tbansal): Change it to return throughput as int32.
|
| virtual bool GetDownlinkThroughputKbpsEstimate(int32_t* kbps) const;
|
|
|
| // Returns true if median RTT at the HTTP layer is available and sets |rtt|
|
| @@ -311,6 +314,7 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
| // layer measures the time from when the request was sent (this happens after
|
| // the connection is established) to the time when the response headers were
|
| // received.
|
| + // TODO(tbansal): Change it to return HTTP RTT as base::TimeDelta.
|
| virtual bool GetRecentHttpRTTMedian(const base::TimeTicks& start_time,
|
| base::TimeDelta* rtt) const
|
| WARN_UNUSED_RESULT;
|
| @@ -318,6 +322,7 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
| // Returns true if the median RTT at the transport layer is available and sets
|
| // |rtt| to the median of transport layer RTT observations since
|
| // |start_time|. |rtt| should not be null. Virtualized for testing.
|
| + // TODO(tbansal): Change it to return transport RTT as base::TimeDelta.
|
| virtual bool GetRecentTransportRTTMedian(const base::TimeTicks& start_time,
|
| base::TimeDelta* rtt) const
|
| WARN_UNUSED_RESULT;
|
| @@ -326,6 +331,7 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
| // to the median of downstream throughput (in kilobits per second)
|
| // observations since |start_time|. Virtualized for testing. |kbps|
|
| // should not be null. Virtualized for testing.
|
| + // TODO(tbansal): Change it to return throughput as int32.
|
| virtual bool GetRecentMedianDownlinkThroughputKbps(
|
| const base::TimeTicks& start_time,
|
| int32_t* kbps) const WARN_UNUSED_RESULT;
|
| @@ -372,10 +378,27 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
| // connection type.
|
| enum class EffectiveConnectionTypeAlgorithm {
|
| HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT = 0,
|
| + TRANSPORT_RTT_OR_DOWNSTREAM_THROUGHOUT,
|
| EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST
|
| };
|
|
|
| + // Defines how a metric (e.g, transport RTT) should be used when computing
|
| + // the effective connection type.
|
| + enum class MetricUsage {
|
| + // The metric should not be used when computing the effective connection
|
| + // type.
|
| + DO_NOT_USE = 0,
|
| + // If the metric is available, then it should be used when computing the
|
| + // effective connection type.
|
| + USE_IF_AVAILABLE,
|
| + // The metric is required when computing the effective connection type.
|
| + // If the value of the metric is unavailable, effective connection type
|
| + // should be set to |EFFECTIVE_CONNECTION_TYPE_UNKNOWN|.
|
| + MUST_BE_USED,
|
| + };
|
| +
|
| // Map from algorithm names to EffectiveConnectionTypeAlgorithm.
|
| + // TODO(tbansal): Consider using an autogenerated enum using macros.
|
| const std::map<std::string, EffectiveConnectionTypeAlgorithm>
|
| algorithm_name_to_enum_;
|
|
|
| @@ -483,12 +506,15 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
| void UpdateSignalStrength();
|
|
|
| // Returns the effective type of the current connection based on only the
|
| - // samples observed after |start_time|. Uses HTTP RTT and downstream
|
| - // throughput to compute the effective connection type, and requires both of
|
| - // them to have a valid value.
|
| - EffectiveConnectionType
|
| - GetRecentEffectiveConnectionTypeHttpRTTAndDownstreamThroughput(
|
| - const base::TimeTicks& start_time) const;
|
| + // samples observed after |start_time|. May use HTTP RTT, transport RTT and
|
| + // downstream throughput to compute the effective connection type based on
|
| + // |http_rtt_metric|, |transport_rtt_metric| and
|
| + // |downstream_throughput_kbps_metric|, respectively.
|
| + EffectiveConnectionType GetRecentEffectiveConnectionTypeUsingMetrics(
|
| + const base::TimeTicks& start_time,
|
| + MetricUsage http_rtt_metric,
|
| + MetricUsage transport_rtt_metric,
|
| + MetricUsage downstream_throughput_kbps_metric) const;
|
|
|
| // Values of external estimate provider status. This enum must remain
|
| // synchronized with the enum of the same name in
|
|
|