Chromium Code Reviews| Index: net/nqe/network_quality_estimator.h |
| diff --git a/net/nqe/network_quality_estimator.h b/net/nqe/network_quality_estimator.h |
| index 57cf98b686864121b3e182072a49cc47a75ed2ba..f67fe4838cbcd5cfe521b8b5b0cb5305e0d03643 100644 |
| --- a/net/nqe/network_quality_estimator.h |
| +++ b/net/nqe/network_quality_estimator.h |
| @@ -322,6 +322,8 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); |
| + FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| + ObtainAlgorithmToUseFromParams); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching); |
| @@ -346,6 +348,25 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| typedef std::map<NetworkID, nqe::internal::CachedNetworkQuality> |
| CachedNetworkQualities; |
| + // Algorithms supported by network quality estimator for computing effective |
| + // connection type. |
| + enum class EffectiveConnectionTypeAlgorithm { |
| + HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT = 0, |
| + EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST |
| + }; |
| + |
| + // Map from algorithm names to EffectiveConnectionTypeAlgorithm. |
| + const std::map<std::string, EffectiveConnectionTypeAlgorithm> |
|
bengr
2016/06/08 23:33:11
This probably shouldn't be in the .h.
tbansal1
2016/06/08 23:48:29
Done.
|
| + stringToAlgorithm_ = {{"HttpRTTAndDownstreamThroughput", |
|
bengr
2016/06/08 23:33:11
Why does this need to be a member? Also how about
tbansal1
2016/06/08 23:48:29
Done.
|
| + EffectiveConnectionTypeAlgorithm:: |
| + HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT}}; |
| + |
| + // The default algorithm to be used if the algorithm value is not available |
| + // through field trial parameters. |
| + static const EffectiveConnectionTypeAlgorithm |
| + kDefaultEffectiveConnectionTypeAlgorithm = |
| + EffectiveConnectionTypeAlgorithm::HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT; |
| + |
| // Minimum valid value of the variation parameter that holds RTT (in |
| // milliseconds) values. |
| static const int kMinimumRTTVariationParameterMsec = 1; |
| @@ -443,6 +464,14 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| // main frame request is observed. |
| void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; |
| + // 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; |
| + |
| // Values of external estimate provider status. This enum must remain |
| // synchronized with the enum of the same name in |
| // metrics/histograms/histograms.xml. |
| @@ -473,6 +502,12 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| // The factor by which the weight of an observation reduces every second. |
| const double weight_multiplier_per_second_; |
| + // Algorithm to use for computing effective connection type. The value is |
| + // obtained from field trial parameters. If the value from field trial |
| + // parameters is unavailable, it is set to |
| + // kDefaultEffectiveConnectionTypeAlgorithm. |
| + const EffectiveConnectionTypeAlgorithm algorithm_; |
|
bengr
2016/06/08 23:33:11
To be clear this should probably be called effecti
tbansal1
2016/06/08 23:48:29
Done.
|
| + |
| // Tick clock used by the network quality estimator. |
| std::unique_ptr<base::TickClock> tick_clock_; |