Chromium Code Reviews| Index: net/nqe/network_quality_estimator_params.h |
| diff --git a/net/nqe/network_quality_estimator_params.h b/net/nqe/network_quality_estimator_params.h |
| index 6d7310f95ea78d8c5816dee522768492ed366dcd..40fe152c815b82e57acbdc26c19a21627be86936 100644 |
| --- a/net/nqe/network_quality_estimator_params.h |
| +++ b/net/nqe/network_quality_estimator_params.h |
| @@ -8,6 +8,8 @@ |
| #include <map> |
| #include <string> |
| +#include "base/macros.h" |
| +#include "base/threading/thread_checker.h" |
| #include "net/base/network_change_notifier.h" |
| #include "net/nqe/effective_connection_type.h" |
| #include "net/nqe/network_quality.h" |
| @@ -18,70 +20,78 @@ namespace nqe { |
| namespace internal { |
| -// Returns the algorithm that should be used for computing effective connection |
| -// type based on field trial params. Returns an empty string if a valid |
| -// algorithm paramter is not present in the field trial params. |
| -std::string GetEffectiveConnectionTypeAlgorithm( |
| - const std::map<std::string, std::string>& variation_params); |
| - |
| -// Computes and returns the weight multiplier per second, which represents the |
| -// factor by which the weight of an observation reduces every second. |
| -// |variation_params| is the map containing all field trial parameters |
| -// related to the NetworkQualityualityEstimator field trial. |
| -double GetWeightMultiplierPerSecond( |
| - const std::map<std::string, std::string>& variation_params); |
| - |
| -// Returns the factor by which the weight of an observation reduces for every |
| -// dBm difference between the current signal strength (in dBm), and the signal |
| -// strength at the time when the observation was taken. |
| -double GetWeightMultiplierPerDbm( |
| - const std::map<std::string, std::string>& variation_params); |
| - |
| -// Returns a descriptive name corresponding to |connection_type|. |
| -const char* GetNameForConnectionType( |
| - net::NetworkChangeNotifier::ConnectionType connection_type); |
| - |
| -// Sets the default observation for different connection types in |
| -// |default_observations|. The default observations are different for different |
| -// connection types (e.g., 2G, 3G, 4G, WiFi). The default observations may be |
| -// used to determine the network quality in absence of any other information. |
| -void ObtainDefaultObservations( |
| - const std::map<std::string, std::string>& variation_params, |
| - nqe::internal::NetworkQuality default_observations[]); |
| - |
| -// Sets |typical_network_quality| to typical network quality for different |
| -// effective connection types. |
| -void ObtainTypicalNetworkQuality(NetworkQuality typical_network_quality[]); |
| - |
| -// Parses the variation paramaters and sets the thresholds for different |
| -// effective connection types in |connection_thresholds|. |
| -void ObtainEffectiveConnectionTypeModelParams( |
| - const std::map<std::string, std::string>& variation_params, |
| - nqe::internal::NetworkQuality connection_thresholds[]); |
| - |
| -// Returns the fraction of URL requests that should record the correlation UMA. |
| -double correlation_uma_logging_probability( |
| - const std::map<std::string, std::string>& variation_params); |
| - |
| -// Returns true if the effective connection type has been determined via |
| -// variation parameters. |
| -bool forced_effective_connection_type_set( |
| - const std::map<std::string, std::string>& variation_params); |
| - |
| -// Returns the effective connection type that was configured by variation |
| -// parameters. |
| -EffectiveConnectionType forced_effective_connection_type( |
| - const std::map<std::string, std::string>& variation_params); |
| - |
| -// Returns true if reading from the persistent cache has been enabled via field |
| -// trial. |
| -bool persistent_cache_reading_enabled( |
| - const std::map<std::string, std::string>& variation_params); |
| - |
| -// Returns the the minimum interval betweeen consecutive notifications to a |
| -// single socket watcher. |
| -base::TimeDelta GetMinSocketWatcherNotificationInterval( |
| - const std::map<std::string, std::string>& variation_params); |
| +class NetworkQualityEstimatorParams { |
|
RyanSturm
2017/03/28 17:23:11
class comment.
tbansal1
2017/03/29 18:17:51
Done.
|
| + public: |
| + explicit NetworkQualityEstimatorParams( |
| + const std::map<std::string, std::string>& params); |
|
RyanSturm
2017/03/28 17:23:11
can you add a method comment to this constructor t
tbansal1
2017/03/29 18:17:51
Done.
|
| + |
| + ~NetworkQualityEstimatorParams(); |
| + |
| + // Returns the algorithm that should be used for computing effective |
|
RyanSturm
2017/03/28 17:23:11
A lot of these comments can remove the references
tbansal1
2017/03/29 18:17:51
Done.
|
| + // connection type based on field trial params. Returns an empty string if a |
| + // valid algorithm paramter is not present in the field trial params. |
| + std::string GetEffectiveConnectionTypeAlgorithm() const; |
| + |
| + // Computes and returns the weight multiplier per second, which represents the |
| + // factor by which the weight of an observation reduces every second. |
| + // |params| is the map containing all field trial parameters |
| + // related to the NetworkQualityualityEstimator field trial. |
| + double GetWeightMultiplierPerSecond() const; |
| + |
| + // Returns the factor by which the weight of an observation reduces for every |
| + // dBm difference between the current signal strength (in dBm), and the signal |
| + // strength at the time when the observation was taken. |
| + double GetWeightMultiplierPerDbm() const; |
| + |
| + // Returns a descriptive name corresponding to |connection_type|. |
| + static const char* GetNameForConnectionType( |
| + net::NetworkChangeNotifier::ConnectionType connection_type); |
| + |
| + // Sets the default observation for different connection types in |
| + // |default_observations|. The default observations are different for |
| + // different connection types (e.g., 2G, 3G, 4G, WiFi). The default |
| + // observations may be used to determine the network quality in absence of any |
| + // other information. |
| + void ObtainDefaultObservations( |
| + nqe::internal::NetworkQuality default_observations[]) const; |
| + |
| + // Sets |typical_network_quality| to typical network quality for different |
| + // effective connection types. |
| + void ObtainTypicalNetworkQuality( |
| + NetworkQuality typical_network_quality[]) const; |
| + |
| + // Parses the variation paramaters and sets the thresholds for different |
| + // effective connection types in |connection_thresholds|. |
| + void ObtainEffectiveConnectionTypeModelParams( |
| + nqe::internal::NetworkQuality connection_thresholds[]) const; |
| + |
| + // Returns the fraction of URL requests that should record the correlation |
| + // UMA. |
| + double correlation_uma_logging_probability() const; |
| + |
| + // Returns true if the effective connection type has been determined via |
| + // variation parameters. |
| + bool forced_effective_connection_type_set() const; |
| + |
| + // Returns the effective connection type that was configured by variation |
| + // parameters. |
| + EffectiveConnectionType forced_effective_connection_type() const; |
| + |
| + // Returns true if reading from the persistent cache has been enabled via |
| + // field trial. |
| + bool persistent_cache_reading_enabled() const; |
| + |
| + // Returns the the minimum interval betweeen consecutive notifications to a |
| + // single socket watcher. |
| + base::TimeDelta GetMinSocketWatcherNotificationInterval() const; |
| + |
| + private: |
| + const std::map<std::string, std::string> params_; |
|
RyanSturm
2017/03/28 17:23:11
Add a comment to this.
tbansal1
2017/03/29 18:17:51
Done.
|
| + |
| + base::ThreadChecker thread_checker_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimatorParams); |
| +}; |
| } // namespace internal |