Chromium Code Reviews| Index: chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| diff --git a/chrome/browser/net/nqe/ui_network_quality_estimator_service.h b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| index cf205e5ed5f08394cecdc4fee8feb037336c7228..dd098bb8e6ed579a2eb1539247045375d2c9232f 100644 |
| --- a/chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| +++ b/chrome/browser/net/nqe/ui_network_quality_estimator_service.h |
| @@ -47,6 +47,20 @@ class UINetworkQualityEstimatorService |
| net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) |
| override; |
| + // Must be called on the UI thread. |observer| will be notified on the UI |
| + // thread. |observer| would be notified of the changes in the HTTP RTT, |
| + // transport RTT or throughput. |observer| would be notified of the current |
| + // values in the next message pump. |
| + void AddRTTAndThroughputEstimatesObserver( |
|
RyanSturm
2017/03/10 19:16:44
I would add these to NetworkQualityProvider interf
tbansal1
2017/03/10 21:57:50
Done.
|
| + net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver* |
| + observer); |
| + |
| + // Removes |observer| from the list of RTT and throughput estimate observers. |
| + // Must be called on the UI thread. |
| + void RemoveRTTAndThroughputEstimatesObserver( |
| + net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver* |
| + observer); |
| + |
| // Registers the profile-specific network quality estimator prefs. |
| static void RegisterProfilePrefs(PrefRegistrySimple* registry); |
| @@ -72,6 +86,12 @@ class UINetworkQualityEstimatorService |
| net::NetworkQualityEstimator::EffectiveConnectionTypeObserver* observer) |
| const; |
| + // Notifies |observer| of the current effective connection type if |observer| |
| + // is still registered as an observer. |
| + void NotifyRTTAndThroughputObserverIfPresent( |
| + net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver* observer) |
| + const; |
| + |
| // KeyedService implementation: |
| void Shutdown() override; |
| @@ -81,9 +101,20 @@ class UINetworkQualityEstimatorService |
| // reported by NetworkchangeNotifier::GetConnectionType. |
| void EffectiveConnectionTypeChanged(net::EffectiveConnectionType type); |
| + // Called when the estimated HTTP RTT, estimated transport RTT or estimated |
| + // downstream throughput is computed. |
| + void RTTOrThroughputComputed(base::TimeDelta http_rtt, |
| + base::TimeDelta transport_rtt, |
| + int32_t downstream_throughput_kbps); |
| + |
| // The current EffectiveConnectionType. |
| net::EffectiveConnectionType type_; |
| + // Current network quality metrics. |
| + base::TimeDelta http_rtt_; |
| + base::TimeDelta transport_rtt_; |
| + int32_t downstream_throughput_kbps_; |
| + |
| // IO thread based observer that is owned by this service. Created on the UI |
| // thread, but used and deleted on the IO thread. |
| std::unique_ptr<IONetworkQualityObserver> io_observer_; |
| @@ -93,6 +124,11 @@ class UINetworkQualityEstimatorService |
| net::NetworkQualityEstimator::EffectiveConnectionTypeObserver> |
| effective_connection_type_observer_list_; |
| + // Observer list for changes in RTT or throughput values. |
| + base::ObserverList< |
| + net::NetworkQualityEstimator::RTTAndThroughputEstimatesObserver> |
| + rtt_throughput_observer_list_; |
| + |
| // Prefs manager that is owned by this service. Created on the UI thread, but |
| // used and deleted on the IO thread. |
| std::unique_ptr<net::NetworkQualitiesPrefsManager> prefs_manager_; |