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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Virtualized for testing. | 207 // Virtualized for testing. |
208 virtual EffectiveConnectionType GetEffectiveConnectionType() const; | 208 virtual EffectiveConnectionType GetEffectiveConnectionType() const; |
209 | 209 |
210 // Returns the effective type of the current connection based on only the | 210 // Returns the effective type of the current connection based on only the |
211 // samples observed after |start_time|. This should only be used for | 211 // samples observed after |start_time|. This should only be used for |
212 // recording the metrics. Virtualized for testing. | 212 // recording the metrics. Virtualized for testing. |
213 virtual EffectiveConnectionType GetRecentEffectiveConnectionType( | 213 virtual EffectiveConnectionType GetRecentEffectiveConnectionType( |
214 const base::TimeTicks& start_time) const; | 214 const base::TimeTicks& start_time) const; |
215 | 215 |
216 // Adds |observer| to the list of effective connection type observers. Must be | 216 // Adds |observer| to the list of effective connection type observers. Must be |
217 // called on the IO thread. | 217 // called on the IO thread. |observer| would be notified of the current |
| 218 // effective connection type in the next message pump, if it is still |
| 219 // registered as an observer. |
218 void AddEffectiveConnectionTypeObserver( | 220 void AddEffectiveConnectionTypeObserver( |
219 EffectiveConnectionTypeObserver* observer); | 221 EffectiveConnectionTypeObserver* observer); |
220 | 222 |
221 // Removes |observer| from the list of effective connection type observers. | 223 // Removes |observer| from the list of effective connection type observers. |
222 // Must be called on the IO thread. | 224 // Must be called on the IO thread. |
223 void RemoveEffectiveConnectionTypeObserver( | 225 void RemoveEffectiveConnectionTypeObserver( |
224 EffectiveConnectionTypeObserver* observer); | 226 EffectiveConnectionTypeObserver* observer); |
225 | 227 |
226 // Adds |observer| to the list of RTT and throughput estimate observers. Must | 228 // Adds |observer| to the list of RTT and throughput estimate observers. Must |
227 // be called on the IO thread. | 229 // be called on the IO thread. |observer| would be notified of the current RTT |
| 230 // and throughput estimates in the next message pump, if it is still |
| 231 // registered as an observer. |
228 void AddRTTAndThroughputEstimatesObserver( | 232 void AddRTTAndThroughputEstimatesObserver( |
229 RTTAndThroughputEstimatesObserver* observer); | 233 RTTAndThroughputEstimatesObserver* observer); |
230 | 234 |
231 // Removes |observer| from the list of RTT and throughput estimate observers. | 235 // Removes |observer| from the list of RTT and throughput estimate observers. |
232 // Must be called on the IO thread. | 236 // Must be called on the IO thread. |
233 void RemoveRTTAndThroughputEstimatesObserver( | 237 void RemoveRTTAndThroughputEstimatesObserver( |
234 RTTAndThroughputEstimatesObserver* observer); | 238 RTTAndThroughputEstimatesObserver* observer); |
235 | 239 |
236 // Notifies NetworkQualityEstimator that the response header of |request| has | 240 // Notifies NetworkQualityEstimator that the response header of |request| has |
237 // been received. | 241 // been received. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // Recomputes effective connection type, if it was computed more than the | 489 // Recomputes effective connection type, if it was computed more than the |
486 // specified duration ago, or if there has been a connection change recently. | 490 // specified duration ago, or if there has been a connection change recently. |
487 void MaybeComputeEffectiveConnectionType(); | 491 void MaybeComputeEffectiveConnectionType(); |
488 | 492 |
489 // Notifies observers of a change in effective connection type. | 493 // Notifies observers of a change in effective connection type. |
490 void NotifyObserversOfEffectiveConnectionTypeChanged(); | 494 void NotifyObserversOfEffectiveConnectionTypeChanged(); |
491 | 495 |
492 // Notifies the observers of RTT or throughput estimates computation. | 496 // Notifies the observers of RTT or throughput estimates computation. |
493 void NotifyObserversOfRTTOrThroughputComputed() const; | 497 void NotifyObserversOfRTTOrThroughputComputed() const; |
494 | 498 |
| 499 // Notifies |observer| of the current effective connection type if |observer| |
| 500 // is still registered as an observer. |
| 501 void NotifyEffectiveConnectionTypeObserverIfPresent( |
| 502 EffectiveConnectionTypeObserver* observer) const; |
| 503 |
| 504 // Notifies |observer| of the current RTT and throughput if |observer| is |
| 505 // still registered as an observer. |
| 506 void NotifyRTTAndThroughputEstimatesObserverIfPresent( |
| 507 RTTAndThroughputEstimatesObserver* observer) const; |
| 508 |
495 // Records NQE accuracy metrics. |measuring_duration| should belong to the | 509 // Records NQE accuracy metrics. |measuring_duration| should belong to the |
496 // vector returned by AccuracyRecordingIntervals(). | 510 // vector returned by AccuracyRecordingIntervals(). |
497 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a | 511 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a |
498 // main frame request is observed. | 512 // main frame request is observed. |
499 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; | 513 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; |
500 | 514 |
501 // Obtains the current cellular signal strength value and updates | 515 // Obtains the current cellular signal strength value and updates |
502 // |min_signal_strength_since_connection_change_| and | 516 // |min_signal_strength_since_connection_change_| and |
503 // |max_signal_strength_since_connection_change_|. | 517 // |max_signal_strength_since_connection_change_|. |
504 void UpdateSignalStrength(); | 518 void UpdateSignalStrength(); |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
695 base::ThreadChecker thread_checker_; | 709 base::ThreadChecker thread_checker_; |
696 | 710 |
697 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 711 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
698 | 712 |
699 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 713 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
700 }; | 714 }; |
701 | 715 |
702 } // namespace net | 716 } // namespace net |
703 | 717 |
704 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 718 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |