OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 private: | 153 private: |
154 DISALLOW_COPY_AND_ASSIGN(ThroughputObserver); | 154 DISALLOW_COPY_AND_ASSIGN(ThroughputObserver); |
155 }; | 155 }; |
156 | 156 |
157 // Provides simple interface to obtain the effective connection type. | 157 // Provides simple interface to obtain the effective connection type. |
158 class NET_EXPORT NetworkQualityProvider { | 158 class NET_EXPORT NetworkQualityProvider { |
159 public: | 159 public: |
160 // Returns the current effective connection type. | 160 // Returns the current effective connection type. |
161 virtual EffectiveConnectionType GetEffectiveConnectionType() const = 0; | 161 virtual EffectiveConnectionType GetEffectiveConnectionType() const = 0; |
162 | 162 |
163 virtual ~NetworkQualityProvider() {} | |
164 | |
163 // Adds |observer| to a list of effective connection type observers. | 165 // Adds |observer| to a list of effective connection type observers. |
164 virtual void AddEffectiveConnectionTypeObserver( | 166 virtual void AddEffectiveConnectionTypeObserver( |
165 EffectiveConnectionTypeObserver* observer) = 0; | 167 EffectiveConnectionTypeObserver* observer) = 0; |
166 | 168 |
167 // Removes |observer| from a list of effective connection type observers. | 169 // Removes |observer| from a list of effective connection type observers. |
168 virtual void RemoveEffectiveConnectionTypeObserver( | 170 virtual void RemoveEffectiveConnectionTypeObserver( |
169 EffectiveConnectionTypeObserver* observer) = 0; | 171 EffectiveConnectionTypeObserver* observer) = 0; |
170 | 172 |
171 virtual ~NetworkQualityProvider() {} | 173 // Adds |observer| to the list of RTT and throughput estimate observers. |
174 // |observer| would be notified of the current RTT and throughput estimates | |
175 // in the next message pump. | |
176 void AddRTTAndThroughputEstimatesObserver( | |
RyanSturm
2017/03/10 22:10:47
virtual
| |
177 RTTAndThroughputEstimatesObserver* observer) override; | |
178 | |
179 // Removes |observer| from the list of RTT and throughput estimate | |
180 // observers. | |
181 void RemoveRTTAndThroughputEstimatesObserver( | |
RyanSturm
2017/03/10 22:10:47
virtual
| |
182 RTTAndThroughputEstimatesObserver* observer) override; | |
172 | 183 |
173 protected: | 184 protected: |
174 NetworkQualityProvider() {} | 185 NetworkQualityProvider() {} |
175 | 186 |
176 private: | 187 private: |
177 DISALLOW_COPY_AND_ASSIGN(NetworkQualityProvider); | 188 DISALLOW_COPY_AND_ASSIGN(NetworkQualityProvider); |
178 }; | 189 }; |
179 | 190 |
180 // Creates a new NetworkQualityEstimator. | 191 // Creates a new NetworkQualityEstimator. |
181 // |variation_params| is the map containing all field trial parameters | 192 // |variation_params| is the map containing all field trial parameters |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
228 EffectiveConnectionTypeObserver* observer); | 239 EffectiveConnectionTypeObserver* observer); |
229 | 240 |
230 // Removes |observer| from the list of effective connection type observers. | 241 // Removes |observer| from the list of effective connection type observers. |
231 // Must be called on the IO thread. | 242 // Must be called on the IO thread. |
232 void RemoveEffectiveConnectionTypeObserver( | 243 void RemoveEffectiveConnectionTypeObserver( |
233 EffectiveConnectionTypeObserver* observer); | 244 EffectiveConnectionTypeObserver* observer); |
234 | 245 |
235 // Adds |observer| to the list of RTT and throughput estimate observers. Must | 246 // Adds |observer| to the list of RTT and throughput estimate observers. Must |
236 // be called on the IO thread. |observer| would be notified of the current RTT | 247 // be called on the IO thread. |observer| would be notified of the current RTT |
237 // and throughput estimates in the next message pump. | 248 // and throughput estimates in the next message pump. |
238 void AddRTTAndThroughputEstimatesObserver( | 249 void AddRTTAndThroughputEstimatesObserver( |
RyanSturm
2017/03/10 22:10:47
Override
tbansal1
2017/03/10 23:22:10
This is not going to work now since NQE does not i
tbansal1
2017/03/10 23:22:11
Done.
RyanSturm
2017/03/11 01:36:13
Yup. No problem. I think eventually we might want
| |
239 RTTAndThroughputEstimatesObserver* observer); | 250 RTTAndThroughputEstimatesObserver* observer); |
240 | 251 |
241 // Removes |observer| from the list of RTT and throughput estimate observers. | 252 // Removes |observer| from the list of RTT and throughput estimate observers. |
242 // Must be called on the IO thread. | 253 // Must be called on the IO thread. |
243 void RemoveRTTAndThroughputEstimatesObserver( | 254 void RemoveRTTAndThroughputEstimatesObserver( |
RyanSturm
2017/03/10 22:10:47
override
tbansal1
2017/03/10 23:22:10
Done.
tbansal1
2017/03/10 23:22:11
same as above.
| |
244 RTTAndThroughputEstimatesObserver* observer); | 255 RTTAndThroughputEstimatesObserver* observer); |
245 | 256 |
246 // Notifies NetworkQualityEstimator that the response header of |request| has | 257 // Notifies NetworkQualityEstimator that the response header of |request| has |
247 // been received. | 258 // been received. |
248 void NotifyHeadersReceived(const URLRequest& request); | 259 void NotifyHeadersReceived(const URLRequest& request); |
249 | 260 |
250 // Notifies NetworkQualityEstimator that the headers of |request| are about to | 261 // Notifies NetworkQualityEstimator that the headers of |request| are about to |
251 // be sent. | 262 // be sent. |
252 void NotifyStartTransaction(const URLRequest& request); | 263 void NotifyStartTransaction(const URLRequest& request); |
253 | 264 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 // If |disable_offline_check| is set to true, then the device offline check is | 300 // If |disable_offline_check| is set to true, then the device offline check is |
290 // disabled when computing the effective connection type or when writing the | 301 // disabled when computing the effective connection type or when writing the |
291 // prefs. | 302 // prefs. |
292 void DisableOfflineCheckForTesting(bool disable_offline_check); | 303 void DisableOfflineCheckForTesting(bool disable_offline_check); |
293 | 304 |
294 // Reports |effective_connection_type| to all | 305 // Reports |effective_connection_type| to all |
295 // EffectiveConnectionTypeObservers. | 306 // EffectiveConnectionTypeObservers. |
296 void ReportEffectiveConnectionTypeForTesting( | 307 void ReportEffectiveConnectionTypeForTesting( |
297 EffectiveConnectionType effective_connection_type); | 308 EffectiveConnectionType effective_connection_type); |
298 | 309 |
310 // Reports the RTTs and throughput to all RTTAndThroughputEstimatesObservers. | |
311 void ReportRTTsAndThroughputForTesting(base::TimeDelta http_rtt, | |
312 base::TimeDelta transport_rtt, | |
313 int32_t downstream_throughput_kbps); | |
314 | |
299 // Adds and removes |observer| from the list of cache observers. | 315 // Adds and removes |observer| from the list of cache observers. |
300 void AddNetworkQualitiesCacheObserver( | 316 void AddNetworkQualitiesCacheObserver( |
301 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* | 317 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* |
302 observer); | 318 observer); |
303 void RemoveNetworkQualitiesCacheObserver( | 319 void RemoveNetworkQualitiesCacheObserver( |
304 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* | 320 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver* |
305 observer); | 321 observer); |
306 | 322 |
307 // Called when the persistent prefs have been read. |read_prefs| contains the | 323 // Called when the persistent prefs have been read. |read_prefs| contains the |
308 // parsed prefs as a map between NetworkIDs and CachedNetworkQualities. | 324 // parsed prefs as a map between NetworkIDs and CachedNetworkQualities. |
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
802 disallowed_observation_sources_for_transport_; | 818 disallowed_observation_sources_for_transport_; |
803 | 819 |
804 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 820 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
805 | 821 |
806 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 822 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
807 }; | 823 }; |
808 | 824 |
809 } // namespace net | 825 } // namespace net |
810 | 826 |
811 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 827 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |