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

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

Issue 2322183002: Add Network Quality Estimator (NQE) pref manager (Closed)
Patch Set: Addressed kundaji comments Created 4 years, 3 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 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 // |use_smaller_responses_for_tests| should only be true when testing. 211 // |use_smaller_responses_for_tests| should only be true when testing.
212 // Allows the responses smaller than |kMinTransferSizeInBits| to be used for 212 // Allows the responses smaller than |kMinTransferSizeInBits| to be used for
213 // network quality estimation. 213 // network quality estimation.
214 void SetUseSmallResponsesForTesting(bool use_small_responses); 214 void SetUseSmallResponsesForTesting(bool use_small_responses);
215 215
216 // Reports |effective_connection_type| to all 216 // Reports |effective_connection_type| to all
217 // EffectiveConnectionTypeObservers. 217 // EffectiveConnectionTypeObservers.
218 void ReportEffectiveConnectionTypeForTesting( 218 void ReportEffectiveConnectionTypeForTesting(
219 EffectiveConnectionType effective_connection_type); 219 EffectiveConnectionType effective_connection_type);
220 220
221 // Adds and removes |observer| from the list of cache observers.
222 void AddNetworkQualitiesCacheObserver(
223 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver*
224 observer);
225 void RemoveNetworkQualitiesCacheObserver(
226 nqe::internal::NetworkQualityStore::NetworkQualitiesCacheObserver*
227 observer);
228
221 protected: 229 protected:
222 // NetworkChangeNotifier::ConnectionTypeObserver implementation: 230 // NetworkChangeNotifier::ConnectionTypeObserver implementation:
223 void OnConnectionTypeChanged( 231 void OnConnectionTypeChanged(
224 NetworkChangeNotifier::ConnectionType type) override; 232 NetworkChangeNotifier::ConnectionType type) override;
225 233
226 // ExternalEstimateProvider::UpdatedEstimateObserver implementation. 234 // ExternalEstimateProvider::UpdatedEstimateObserver implementation.
227 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt, 235 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt,
228 int32_t downstream_throughput_kbps, 236 int32_t downstream_throughput_kbps,
229 int32_t upstream_throughput_kbps) override; 237 int32_t upstream_throughput_kbps) override;
230 238
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // prediction should be recorded. Virtualized for testing. 286 // prediction should be recorded. Virtualized for testing.
279 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() 287 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals()
280 const; 288 const;
281 289
282 // Overrides the tick clock used by |this| for testing. 290 // Overrides the tick clock used by |this| for testing.
283 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); 291 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
284 292
285 // Returns a random double in the range [0.0, 1.0). Virtualized for testing. 293 // Returns a random double in the range [0.0, 1.0). Virtualized for testing.
286 virtual double RandDouble() const; 294 virtual double RandDouble() const;
287 295
288 // Returns a pointer to |network_quality_store_|. Used only for testing.
289 nqe::internal::NetworkQualityStore* NetworkQualityStoreForTesting() const;
290
291 private: 296 private:
292 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 297 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
293 AdaptiveRecomputationEffectiveConnectionType); 298 AdaptiveRecomputationEffectiveConnectionType);
294 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); 299 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations);
295 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); 300 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation);
296 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); 301 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams);
297 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 302 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
298 ObtainAlgorithmToUseFromParams); 303 ObtainAlgorithmToUseFromParams);
299 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); 304 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam);
300 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); 305 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles);
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 base::ThreadChecker thread_checker_; 633 base::ThreadChecker thread_checker_;
629 634
630 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 635 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
631 636
632 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 637 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
633 }; 638 };
634 639
635 } // namespace net 640 } // namespace net
636 641
637 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 642 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698