OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ |
6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/optional.h" | 12 #include "base/optional.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
15 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
16 #include "net/nqe/effective_connection_type.h" | 16 #include "net/nqe/effective_connection_type.h" |
17 #include "net/nqe/network_quality.h" | 17 #include "net/nqe/network_quality.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 // Forces NQE to return a specific effective connection type. Set using the | 21 // Forces NQE to return a specific effective connection type. Set using the |
22 // |params| provided to the NetworkQualityEstimatorParams constructor. | 22 // |params| provided to the NetworkQualityEstimatorParams constructor. |
23 NET_EXPORT extern const char kForceEffectiveConnectionType[]; | 23 NET_EXPORT extern const char kForceEffectiveConnectionType[]; |
24 | 24 |
25 namespace nqe { | |
26 | |
27 namespace internal { | |
28 | |
29 // NetworkQualityEstimatorParams computes the configuration parameters for | 25 // NetworkQualityEstimatorParams computes the configuration parameters for |
30 // the network quality estimator. | 26 // the network quality estimator. |
31 class NET_EXPORT_PRIVATE NetworkQualityEstimatorParams { | 27 class NET_EXPORT NetworkQualityEstimatorParams { |
32 public: | 28 public: |
33 // |params| is the map containing all field trial parameters related to | 29 // |params| is the map containing all field trial parameters related to |
34 // NetworkQualityEstimator field trial. | 30 // NetworkQualityEstimator field trial. |
35 explicit NetworkQualityEstimatorParams( | 31 explicit NetworkQualityEstimatorParams( |
36 const std::map<std::string, std::string>& params); | 32 const std::map<std::string, std::string>& params); |
37 | 33 |
38 ~NetworkQualityEstimatorParams(); | 34 ~NetworkQualityEstimatorParams(); |
39 | 35 |
40 // Returns the algorithm that should be used for computing effective | 36 // Returns the algorithm that should be used for computing effective |
41 // connection type. Returns an empty string if a valid algorithm paramter is | 37 // connection type. Returns an empty string if a valid algorithm paramter is |
42 // not specified. | 38 // not specified. |
43 std::string GetEffectiveConnectionTypeAlgorithm() const; | 39 std::string GetEffectiveConnectionTypeAlgorithm() const; |
44 | 40 |
45 // Returns a descriptive name corresponding to |connection_type|. | 41 // Returns a descriptive name corresponding to |connection_type|. |
46 static const char* GetNameForConnectionType( | 42 static const char* GetNameForConnectionType( |
47 NetworkChangeNotifier::ConnectionType connection_type); | 43 NetworkChangeNotifier::ConnectionType connection_type); |
48 | 44 |
49 // Returns the default observation for connection |type|. The default | 45 // Returns the default observation for connection |type|. The default |
50 // observations are different for different connection types (e.g., 2G, 3G, | 46 // observations are different for different connection types (e.g., 2G, 3G, |
51 // 4G, WiFi). The default observations may be used to determine the network | 47 // 4G, WiFi). The default observations may be used to determine the network |
52 // quality in absence of any other information. | 48 // quality in absence of any other information. |
53 const NetworkQuality& DefaultObservation( | 49 const nqe::internal::NetworkQuality& DefaultObservation( |
54 NetworkChangeNotifier::ConnectionType type) const; | 50 NetworkChangeNotifier::ConnectionType type) const; |
55 | 51 |
56 // Returns the typical network quality for connection |type|. | 52 // Returns the typical network quality for connection |type|. |
57 const NetworkQuality& TypicalNetworkQuality( | 53 const nqe::internal::NetworkQuality& TypicalNetworkQuality( |
58 EffectiveConnectionType type) const; | 54 EffectiveConnectionType type) const; |
59 | 55 |
60 // Returns the threshold for effective connection type |type|. | 56 // Returns the threshold for effective connection type |type|. |
61 const NetworkQuality& ConnectionThreshold(EffectiveConnectionType type) const; | 57 const nqe::internal::NetworkQuality& ConnectionThreshold( |
| 58 EffectiveConnectionType type) const; |
62 | 59 |
63 // Returns the minimum number of requests in-flight to consider the network | 60 // Returns the minimum number of requests in-flight to consider the network |
64 // fully utilized. A throughput observation is taken only when the network is | 61 // fully utilized. A throughput observation is taken only when the network is |
65 // considered as fully utilized. | 62 // considered as fully utilized. |
66 size_t throughput_min_requests_in_flight() const { | 63 size_t throughput_min_requests_in_flight() const { |
67 return throughput_min_requests_in_flight_; | 64 return throughput_min_requests_in_flight_; |
68 } | 65 } |
69 | 66 |
70 // Returns the weight multiplier per second, which represents the factor by | 67 // Returns the weight multiplier per second, which represents the factor by |
71 // which the weight of an observation reduces every second. | 68 // which the weight of an observation reduces every second. |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 const size_t throughput_min_requests_in_flight_; | 110 const size_t throughput_min_requests_in_flight_; |
114 const double weight_multiplier_per_second_; | 111 const double weight_multiplier_per_second_; |
115 const double weight_multiplier_per_dbm_; | 112 const double weight_multiplier_per_dbm_; |
116 const double correlation_uma_logging_probability_; | 113 const double correlation_uma_logging_probability_; |
117 const base::Optional<EffectiveConnectionType> | 114 const base::Optional<EffectiveConnectionType> |
118 forced_effective_connection_type_; | 115 forced_effective_connection_type_; |
119 const bool persistent_cache_reading_enabled_; | 116 const bool persistent_cache_reading_enabled_; |
120 const base::TimeDelta min_socket_watcher_notification_interval_; | 117 const base::TimeDelta min_socket_watcher_notification_interval_; |
121 | 118 |
122 // Default network quality observations obtained from |params_|. | 119 // Default network quality observations obtained from |params_|. |
123 NetworkQuality | 120 nqe::internal::NetworkQuality |
124 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; | 121 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; |
125 | 122 |
126 // Typical network quality for different effective connection types obtained | 123 // Typical network quality for different effective connection types obtained |
127 // from |params_|. | 124 // from |params_|. |
128 NetworkQuality typical_network_quality_ | 125 nqe::internal::NetworkQuality typical_network_quality_ |
129 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; | 126 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; |
130 | 127 |
131 // Thresholds for different effective connection types obtained from | 128 // Thresholds for different effective connection types obtained from |
132 // |params_|. These thresholds encode how different connection types behave | 129 // |params_|. These thresholds encode how different connection types behave |
133 // in general. | 130 // in general. |
134 NetworkQuality connection_thresholds_ | 131 nqe::internal::NetworkQuality connection_thresholds_ |
135 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; | 132 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; |
136 | 133 |
137 base::ThreadChecker thread_checker_; | 134 base::ThreadChecker thread_checker_; |
138 | 135 |
139 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimatorParams); | 136 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimatorParams); |
140 }; | 137 }; |
141 | 138 |
142 } // namespace internal | |
143 | |
144 } // namespace nqe | |
145 | |
146 } // namespace net | 139 } // namespace net |
147 | 140 |
148 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ | 141 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ |
OLD | NEW |