| 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 virtual void AddRTTAndThroughputEstimatesObserver( |
| 177 RTTAndThroughputEstimatesObserver* observer) = 0; |
| 178 |
| 179 // Removes |observer| from the list of RTT and throughput estimate |
| 180 // observers. |
| 181 virtual void RemoveRTTAndThroughputEstimatesObserver( |
| 182 RTTAndThroughputEstimatesObserver* observer) = 0; |
| 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 107 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 |