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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
279 // prediction should be recorded. Virtualized for testing. | 279 // prediction should be recorded. Virtualized for testing. |
280 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() | 280 virtual const std::vector<base::TimeDelta>& GetAccuracyRecordingIntervals() |
281 const; | 281 const; |
282 | 282 |
283 // Overrides the tick clock used by |this| for testing. | 283 // Overrides the tick clock used by |this| for testing. |
284 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); | 284 void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock); |
285 | 285 |
286 // Returns a random double in the range [0.0, 1.0). Virtualized for testing. | 286 // Returns a random double in the range [0.0, 1.0). Virtualized for testing. |
287 virtual double RandDouble() const; | 287 virtual double RandDouble() const; |
288 | 288 |
289 // Returns |network_quality_store_|. Used only for testing. | |
bengr
2016/08/25 18:42:59
Technically, this should be "Returns a pointer to"
tbansal1
2016/08/25 20:31:07
Done.
| |
290 nqe::internal::NetworkQualityStore* NetworkQualityStoreForTesting() const; | |
291 | |
289 private: | 292 private: |
290 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 293 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
291 AdaptiveRecomputationEffectiveConnectionType); | 294 AdaptiveRecomputationEffectiveConnectionType); |
292 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); | 295 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
293 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); | 296 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
294 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); | 297 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ObtainOperatingParams); |
295 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 298 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
296 ObtainAlgorithmToUseFromParams); | 299 ObtainAlgorithmToUseFromParams); |
297 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); | 300 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, HalfLifeParam); |
298 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); | 301 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
604 int32_t max_signal_strength_since_connection_change_; | 607 int32_t max_signal_strength_since_connection_change_; |
605 | 608 |
606 // It is costlier to add values to a sparse histogram. So, the correlation UMA | 609 // It is costlier to add values to a sparse histogram. So, the correlation UMA |
607 // is recorded with |correlation_uma_logging_probability_| since recording it | 610 // is recorded with |correlation_uma_logging_probability_| since recording it |
608 // in a sparse histogram for each request is unnecessary and cost-prohibitive. | 611 // in a sparse histogram for each request is unnecessary and cost-prohibitive. |
609 // e.g., if it is 0.0, then the UMA will never be recorded. On the other hand, | 612 // e.g., if it is 0.0, then the UMA will never be recorded. On the other hand, |
610 // if it is 1.0, then it will be recorded for all valid HTTP requests. | 613 // if it is 1.0, then it will be recorded for all valid HTTP requests. |
611 const double correlation_uma_logging_probability_; | 614 const double correlation_uma_logging_probability_; |
612 | 615 |
613 // Stores the qualities of different networks. | 616 // Stores the qualities of different networks. |
614 nqe::internal::NetworkQualityStore network_quality_store_; | 617 std::unique_ptr<nqe::internal::NetworkQualityStore> network_quality_store_; |
615 | 618 |
616 base::ThreadChecker thread_checker_; | 619 base::ThreadChecker thread_checker_; |
617 | 620 |
618 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 621 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
619 | 622 |
620 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 623 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
621 }; | 624 }; |
622 | 625 |
623 } // namespace net | 626 } // namespace net |
624 | 627 |
625 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 628 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |