Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: net/nqe/network_quality_estimator_params.h

Issue 2416473004: Add functionality for embedders to configure NQE (Closed)
Patch Set: ps Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // UMA. 89 // UMA.
90 double correlation_uma_logging_probability() const { 90 double correlation_uma_logging_probability() const {
91 return correlation_uma_logging_probability_; 91 return correlation_uma_logging_probability_;
92 } 92 }
93 93
94 // Returns an unset value if the effective connection type has not been forced 94 // Returns an unset value if the effective connection type has not been forced
95 // via the |params| provided to this class. Otherwise, returns a value set to 95 // via the |params| provided to this class. Otherwise, returns a value set to
96 // the effective connection type that has been forced. 96 // the effective connection type that has been forced.
97 base::Optional<EffectiveConnectionType> forced_effective_connection_type() 97 base::Optional<EffectiveConnectionType> forced_effective_connection_type()
98 const { 98 const {
99 DCHECK(thread_checker_.CalledOnValidThread());
99 return forced_effective_connection_type_; 100 return forced_effective_connection_type_;
100 } 101 }
101 102
103 void SetForcedEffectiveConnectionType(
104 EffectiveConnectionType forced_effective_connection_type) {
105 DCHECK(thread_checker_.CalledOnValidThread());
106 forced_effective_connection_type_ = forced_effective_connection_type;
107 }
108
102 // Returns true if reading from the persistent cache is enabled. 109 // Returns true if reading from the persistent cache is enabled.
103 bool persistent_cache_reading_enabled() const { 110 bool persistent_cache_reading_enabled() const {
111 DCHECK(thread_checker_.CalledOnValidThread());
104 return persistent_cache_reading_enabled_; 112 return persistent_cache_reading_enabled_;
105 } 113 }
106 114
115 void set_persistent_cache_reading_enabled(
116 bool persistent_cache_reading_enabled) {
117 DCHECK(thread_checker_.CalledOnValidThread());
118 persistent_cache_reading_enabled_ = persistent_cache_reading_enabled;
119 }
120
107 // Returns the the minimum interval betweeen consecutive notifications to a 121 // Returns the the minimum interval betweeen consecutive notifications to a
108 // single socket watcher. 122 // single socket watcher.
109 base::TimeDelta min_socket_watcher_notification_interval() const { 123 base::TimeDelta min_socket_watcher_notification_interval() const {
110 return min_socket_watcher_notification_interval_; 124 return min_socket_watcher_notification_interval_;
111 } 125 }
112 126
113 // Returns the algorithm that should be used for computing effective 127 // Returns the algorithm that should be used for computing effective
114 // connection type. Returns an empty string if a valid algorithm parameter is 128 // connection type. Returns an empty string if a valid algorithm parameter is
115 // not specified. 129 // not specified.
116 static EffectiveConnectionTypeAlgorithm 130 static EffectiveConnectionTypeAlgorithm
117 GetEffectiveConnectionTypeAlgorithmFromString( 131 GetEffectiveConnectionTypeAlgorithmFromString(
118 const std::string& algorithm_param_value); 132 const std::string& algorithm_param_value);
119 133
134 void SetEffectiveConnectionTypeAlgorithm(
135 EffectiveConnectionTypeAlgorithm algorithm) {
136 DCHECK(thread_checker_.CalledOnValidThread());
137 effective_connection_type_algorithm_ = algorithm;
138 }
139
140 void DetachFromThread() { thread_checker_.DetachFromThread(); }
mgersh 2017/06/28 18:26:50 While you're here, can this ThreadChecker be chang
tbansal1 2017/06/29 01:17:58 Done.
141
120 private: 142 private:
121 // Map containing all field trial parameters related to 143 // Map containing all field trial parameters related to
122 // NetworkQualityEstimator field trial. 144 // NetworkQualityEstimator field trial.
123 const std::map<std::string, std::string> params_; 145 const std::map<std::string, std::string> params_;
124 146
125 const size_t throughput_min_requests_in_flight_; 147 const size_t throughput_min_requests_in_flight_;
126 const double weight_multiplier_per_second_; 148 const double weight_multiplier_per_second_;
127 const double weight_multiplier_per_dbm_; 149 const double weight_multiplier_per_dbm_;
128 const double correlation_uma_logging_probability_; 150 const double correlation_uma_logging_probability_;
129 const base::Optional<EffectiveConnectionType> 151 base::Optional<EffectiveConnectionType> forced_effective_connection_type_;
130 forced_effective_connection_type_; 152 bool persistent_cache_reading_enabled_;
131 const bool persistent_cache_reading_enabled_;
132 const base::TimeDelta min_socket_watcher_notification_interval_; 153 const base::TimeDelta min_socket_watcher_notification_interval_;
133 154
134 EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_; 155 EffectiveConnectionTypeAlgorithm effective_connection_type_algorithm_;
135 156
136 // Default network quality observations obtained from |params_|. 157 // Default network quality observations obtained from |params_|.
137 nqe::internal::NetworkQuality 158 nqe::internal::NetworkQuality
138 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1]; 159 default_observations_[NetworkChangeNotifier::CONNECTION_LAST + 1];
139 160
140 // Typical network quality for different effective connection types obtained 161 // Typical network quality for different effective connection types obtained
141 // from |params_|. 162 // from |params_|.
142 nqe::internal::NetworkQuality typical_network_quality_ 163 nqe::internal::NetworkQuality typical_network_quality_
143 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; 164 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST];
144 165
145 // Thresholds for different effective connection types obtained from 166 // Thresholds for different effective connection types obtained from
146 // |params_|. These thresholds encode how different connection types behave 167 // |params_|. These thresholds encode how different connection types behave
147 // in general. 168 // in general.
148 nqe::internal::NetworkQuality connection_thresholds_ 169 nqe::internal::NetworkQuality connection_thresholds_
149 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST]; 170 [EffectiveConnectionType::EFFECTIVE_CONNECTION_TYPE_LAST];
150 171
151 base::ThreadChecker thread_checker_; 172 base::ThreadChecker thread_checker_;
152 173
153 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimatorParams); 174 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimatorParams);
154 }; 175 };
155 176
156 } // namespace net 177 } // namespace net
157 178
158 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_ 179 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_PARAMS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698