| 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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 protected: | 298 protected: |
| 299 // NetworkChangeNotifier::ConnectionTypeObserver implementation: | 299 // NetworkChangeNotifier::ConnectionTypeObserver implementation: |
| 300 void OnConnectionTypeChanged( | 300 void OnConnectionTypeChanged( |
| 301 NetworkChangeNotifier::ConnectionType type) override; | 301 NetworkChangeNotifier::ConnectionType type) override; |
| 302 | 302 |
| 303 // ExternalEstimateProvider::UpdatedEstimateObserver implementation. | 303 // ExternalEstimateProvider::UpdatedEstimateObserver implementation. |
| 304 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt, | 304 void OnUpdatedEstimateAvailable(const base::TimeDelta& rtt, |
| 305 int32_t downstream_throughput_kbps, | 305 int32_t downstream_throughput_kbps, |
| 306 int32_t upstream_throughput_kbps) override; | 306 int32_t upstream_throughput_kbps) override; |
| 307 | 307 |
| 308 // Returns true if the RTT is available and sets |rtt| to the RTT estimated at | |
| 309 // the HTTP layer. Virtualized for testing. |rtt| should not be null. The RTT | |
| 310 // at the HTTP layer measures the time from when the request was sent (this | |
| 311 // happens after the connection is established) to the time when the response | |
| 312 // headers were received. | |
| 313 // TODO(tbansal): Change it to return HTTP RTT as base::TimeDelta. | |
| 314 virtual bool GetHttpRTT(base::TimeDelta* rtt) const WARN_UNUSED_RESULT; | |
| 315 | |
| 316 // Returns true if the RTT is available and sets |rtt| to the RTT estimated at | |
| 317 // the transport layer. |rtt| should not be null. Virtualized for testing. | |
| 318 // TODO(tbansal): Change it to return transport RTT as base::TimeDelta. | |
| 319 virtual bool GetTransportRTT(base::TimeDelta* rtt) const WARN_UNUSED_RESULT; | |
| 320 | |
| 321 // Returns true if downlink throughput is available and sets |kbps| to | |
| 322 // estimated downlink throughput (in kilobits per second). | |
| 323 // Virtualized for testing. |kbps| should not be null. | |
| 324 // TODO(tbansal): Change it to return throughput as int32. | |
| 325 virtual bool GetDownlinkThroughputKbps(int32_t* kbps) const; | |
| 326 | |
| 327 // Returns true if median RTT at the HTTP layer is available and sets |rtt| | 308 // Returns true if median RTT at the HTTP layer is available and sets |rtt| |
| 328 // to the median of RTT observations since |start_time|. | 309 // to the median of RTT observations since |start_time|. |
| 329 // Virtualized for testing. |rtt| should not be null. The RTT at the HTTP | 310 // Virtualized for testing. |rtt| should not be null. The RTT at the HTTP |
| 330 // layer measures the time from when the request was sent (this happens after | 311 // layer measures the time from when the request was sent (this happens after |
| 331 // the connection is established) to the time when the response headers were | 312 // the connection is established) to the time when the response headers were |
| 332 // received. | 313 // received. |
| 333 // TODO(tbansal): Change it to return HTTP RTT as base::TimeDelta. | 314 // TODO(tbansal): Change it to return HTTP RTT as base::TimeDelta. |
| 334 virtual bool GetRecentHttpRTT(const base::TimeTicks& start_time, | 315 virtual bool GetRecentHttpRTT(const base::TimeTicks& start_time, |
| 335 base::TimeDelta* rtt) const WARN_UNUSED_RESULT; | 316 base::TimeDelta* rtt) const WARN_UNUSED_RESULT; |
| 336 | 317 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 const base::TimeDelta effective_connection_type_recomputation_interval_; | 655 const base::TimeDelta effective_connection_type_recomputation_interval_; |
| 675 | 656 |
| 676 // Time when the effective connection type was last computed. | 657 // Time when the effective connection type was last computed. |
| 677 base::TimeTicks last_effective_connection_type_computation_; | 658 base::TimeTicks last_effective_connection_type_computation_; |
| 678 | 659 |
| 679 // Number of RTT and bandwidth samples available when effective connection | 660 // Number of RTT and bandwidth samples available when effective connection |
| 680 // type was last recomputed. | 661 // type was last recomputed. |
| 681 size_t rtt_observations_size_at_last_ect_computation_; | 662 size_t rtt_observations_size_at_last_ect_computation_; |
| 682 size_t throughput_observations_size_at_last_ect_computation_; | 663 size_t throughput_observations_size_at_last_ect_computation_; |
| 683 | 664 |
| 684 // Current estimates of the HTTP RTT, transport RTT and downstream throughput | 665 // Current estimate of the network quality. |
| 685 // (in kilobits per second). | 666 nqe::internal::NetworkQuality network_quality_; |
| 686 base::TimeDelta http_rtt_; | |
| 687 base::TimeDelta transport_rtt_; | |
| 688 int32_t downstream_throughput_kbps_; | |
| 689 | 667 |
| 690 // Current effective connection type. It is updated on connection change | 668 // Current effective connection type. It is updated on connection change |
| 691 // events. It is also updated every time there is network traffic (provided | 669 // events. It is also updated every time there is network traffic (provided |
| 692 // the last computation was more than | 670 // the last computation was more than |
| 693 // |effective_connection_type_recomputation_interval_| ago). | 671 // |effective_connection_type_recomputation_interval_| ago). |
| 694 EffectiveConnectionType effective_connection_type_; | 672 EffectiveConnectionType effective_connection_type_; |
| 695 | 673 |
| 696 // Minimum and Maximum signal strength (in dbM) observed since last connection | 674 // Minimum and Maximum signal strength (in dbM) observed since last connection |
| 697 // change. Updated on connection change and main frame requests. | 675 // change. Updated on connection change and main frame requests. |
| 698 int32_t min_signal_strength_since_connection_change_; | 676 int32_t min_signal_strength_since_connection_change_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 717 base::ThreadChecker thread_checker_; | 695 base::ThreadChecker thread_checker_; |
| 718 | 696 |
| 719 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 697 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| 720 | 698 |
| 721 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 699 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 722 }; | 700 }; |
| 723 | 701 |
| 724 } // namespace net | 702 } // namespace net |
| 725 | 703 |
| 726 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 704 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |