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