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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 virtual base::TimeDelta GetRTTEstimateInternal( | 440 virtual base::TimeDelta GetRTTEstimateInternal( |
441 const std::vector<NetworkQualityObservationSource>& | 441 const std::vector<NetworkQualityObservationSource>& |
442 disallowed_observation_sources, | 442 disallowed_observation_sources, |
443 base::TimeTicks start_time, | 443 base::TimeTicks start_time, |
444 const base::Optional<Statistic>& statistic, | 444 const base::Optional<Statistic>& statistic, |
445 int percentile) const; | 445 int percentile) const; |
446 int32_t GetDownlinkThroughputKbpsEstimateInternal( | 446 int32_t GetDownlinkThroughputKbpsEstimateInternal( |
447 const base::TimeTicks& start_time, | 447 const base::TimeTicks& start_time, |
448 int percentile) const; | 448 int percentile) const; |
449 | 449 |
| 450 // Notifies the observers of RTT or throughput estimates computation. |
| 451 virtual void NotifyObserversOfRTTOrThroughputComputed() const; |
| 452 |
| 453 // Notifies |observer| of the current RTT and throughput if |observer| is |
| 454 // still registered as an observer. |
| 455 virtual void NotifyRTTAndThroughputEstimatesObserverIfPresent( |
| 456 RTTAndThroughputEstimatesObserver* observer) const; |
| 457 |
450 // Observer list for RTT or throughput estimates. Protected for testing. | 458 // Observer list for RTT or throughput estimates. Protected for testing. |
451 base::ObserverList<RTTAndThroughputEstimatesObserver> | 459 base::ObserverList<RTTAndThroughputEstimatesObserver> |
452 rtt_and_throughput_estimates_observer_list_; | 460 rtt_and_throughput_estimates_observer_list_; |
453 | 461 |
454 private: | 462 private: |
455 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 463 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
456 AdaptiveRecomputationEffectiveConnectionType); | 464 AdaptiveRecomputationEffectiveConnectionType); |
457 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); | 465 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
458 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); | 466 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
459 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 467 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 // Returns true only if the |request| can be used for RTT estimation. | 564 // Returns true only if the |request| can be used for RTT estimation. |
557 bool RequestProvidesRTTObservation(const URLRequest& request) const; | 565 bool RequestProvidesRTTObservation(const URLRequest& request) const; |
558 | 566 |
559 // Recomputes effective connection type, if it was computed more than the | 567 // Recomputes effective connection type, if it was computed more than the |
560 // specified duration ago, or if there has been a connection change recently. | 568 // specified duration ago, or if there has been a connection change recently. |
561 void MaybeComputeEffectiveConnectionType(); | 569 void MaybeComputeEffectiveConnectionType(); |
562 | 570 |
563 // Notifies observers of a change in effective connection type. | 571 // Notifies observers of a change in effective connection type. |
564 void NotifyObserversOfEffectiveConnectionTypeChanged(); | 572 void NotifyObserversOfEffectiveConnectionTypeChanged(); |
565 | 573 |
566 // Notifies the observers of RTT or throughput estimates computation. | |
567 void NotifyObserversOfRTTOrThroughputComputed() const; | |
568 | |
569 // Notifies |observer| of the current effective connection type if |observer| | 574 // Notifies |observer| of the current effective connection type if |observer| |
570 // is still registered as an observer. | 575 // is still registered as an observer. |
571 void NotifyEffectiveConnectionTypeObserverIfPresent( | 576 void NotifyEffectiveConnectionTypeObserverIfPresent( |
572 EffectiveConnectionTypeObserver* observer) const; | 577 EffectiveConnectionTypeObserver* observer) const; |
573 | 578 |
574 // Notifies |observer| of the current RTT and throughput if |observer| is | |
575 // still registered as an observer. | |
576 void NotifyRTTAndThroughputEstimatesObserverIfPresent( | |
577 RTTAndThroughputEstimatesObserver* observer) const; | |
578 | |
579 // Records NQE accuracy metrics. |measuring_duration| should belong to the | 579 // Records NQE accuracy metrics. |measuring_duration| should belong to the |
580 // vector returned by AccuracyRecordingIntervals(). | 580 // vector returned by AccuracyRecordingIntervals(). |
581 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a | 581 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a |
582 // main frame request is observed. | 582 // main frame request is observed. |
583 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; | 583 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; |
584 | 584 |
585 // Obtains the current cellular signal strength value and updates | 585 // Obtains the current cellular signal strength value and updates |
586 // |min_signal_strength_since_connection_change_| and | 586 // |min_signal_strength_since_connection_change_| and |
587 // |max_signal_strength_since_connection_change_|. | 587 // |max_signal_strength_since_connection_change_|. |
588 void UpdateSignalStrength(); | 588 void UpdateSignalStrength(); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 disallowed_observation_sources_for_transport_; | 787 disallowed_observation_sources_for_transport_; |
788 | 788 |
789 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 789 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
790 | 790 |
791 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 791 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
792 }; | 792 }; |
793 | 793 |
794 } // namespace net | 794 } // namespace net |
795 | 795 |
796 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 796 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |