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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 // Returns true only if the |request| can be used for RTT estimation. | 570 // Returns true only if the |request| can be used for RTT estimation. |
563 bool RequestProvidesRTTObservation(const URLRequest& request) const; | 571 bool RequestProvidesRTTObservation(const URLRequest& request) const; |
564 | 572 |
565 // Recomputes effective connection type, if it was computed more than the | 573 // Recomputes effective connection type, if it was computed more than the |
566 // specified duration ago, or if there has been a connection change recently. | 574 // specified duration ago, or if there has been a connection change recently. |
567 void MaybeComputeEffectiveConnectionType(); | 575 void MaybeComputeEffectiveConnectionType(); |
568 | 576 |
569 // Notifies observers of a change in effective connection type. | 577 // Notifies observers of a change in effective connection type. |
570 void NotifyObserversOfEffectiveConnectionTypeChanged(); | 578 void NotifyObserversOfEffectiveConnectionTypeChanged(); |
571 | 579 |
572 // Notifies the observers of RTT or throughput estimates computation. | |
573 void NotifyObserversOfRTTOrThroughputComputed() const; | |
574 | |
575 // Notifies |observer| of the current effective connection type if |observer| | 580 // Notifies |observer| of the current effective connection type if |observer| |
576 // is still registered as an observer. | 581 // is still registered as an observer. |
577 void NotifyEffectiveConnectionTypeObserverIfPresent( | 582 void NotifyEffectiveConnectionTypeObserverIfPresent( |
578 EffectiveConnectionTypeObserver* observer) const; | 583 EffectiveConnectionTypeObserver* observer) const; |
579 | 584 |
580 // Notifies |observer| of the current RTT and throughput if |observer| is | |
581 // still registered as an observer. | |
582 void NotifyRTTAndThroughputEstimatesObserverIfPresent( | |
583 RTTAndThroughputEstimatesObserver* observer) const; | |
584 | |
585 // Records NQE accuracy metrics. |measuring_duration| should belong to the | 585 // Records NQE accuracy metrics. |measuring_duration| should belong to the |
586 // vector returned by AccuracyRecordingIntervals(). | 586 // vector returned by AccuracyRecordingIntervals(). |
587 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a | 587 // RecordAccuracyAfterMainFrame should be called |measuring_duration| after a |
588 // main frame request is observed. | 588 // main frame request is observed. |
589 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; | 589 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; |
590 | 590 |
591 // Obtains the current cellular signal strength value and updates | 591 // Obtains the current cellular signal strength value and updates |
592 // |min_signal_strength_since_connection_change_| and | 592 // |min_signal_strength_since_connection_change_| and |
593 // |max_signal_strength_since_connection_change_|. | 593 // |max_signal_strength_since_connection_change_|. |
594 void UpdateSignalStrength(); | 594 void UpdateSignalStrength(); |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 disallowed_observation_sources_for_transport_; | 810 disallowed_observation_sources_for_transport_; |
811 | 811 |
812 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 812 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
813 | 813 |
814 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 814 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
815 }; | 815 }; |
816 | 816 |
817 } // namespace net | 817 } // namespace net |
818 | 818 |
819 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 819 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |