| 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 418 |
| 419 // Maximum size of the cache that holds network quality estimates. | 419 // Maximum size of the cache that holds network quality estimates. |
| 420 // Smaller size may reduce the cache hit rate due to frequent evictions. | 420 // Smaller size may reduce the cache hit rate due to frequent evictions. |
| 421 // Larger size may affect performance. | 421 // Larger size may affect performance. |
| 422 static const size_t kMaximumNetworkQualityCacheSize = 10; | 422 static const size_t kMaximumNetworkQualityCacheSize = 10; |
| 423 | 423 |
| 424 // Returns the RTT value to be used when the valid RTT is unavailable. Readers | 424 // Returns the RTT value to be used when the valid RTT is unavailable. Readers |
| 425 // should discard RTT if it is set to the value returned by |InvalidRTT()|. | 425 // should discard RTT if it is set to the value returned by |InvalidRTT()|. |
| 426 static const base::TimeDelta InvalidRTT(); | 426 static const base::TimeDelta InvalidRTT(); |
| 427 | 427 |
| 428 // Queries external estimate provider for network quality. When the network |
| 429 // quality is available, OnUpdatedEstimateAvailable() is called. |
| 430 void MaybeQueryExternalEstimateProvider() const; |
| 431 |
| 428 // Records UMA when there is a change in connection type. | 432 // Records UMA when there is a change in connection type. |
| 429 void RecordMetricsOnConnectionTypeChanged() const; | 433 void RecordMetricsOnConnectionTypeChanged() const; |
| 430 | 434 |
| 431 // Records UMA on main frame requests. | 435 // Records UMA on main frame requests. |
| 432 void RecordMetricsOnMainFrameRequest() const; | 436 void RecordMetricsOnMainFrameRequest() const; |
| 433 | 437 |
| 434 // Records a downstream throughput observation to the observation buffer if | 438 // Records a downstream throughput observation to the observation buffer if |
| 435 // a valid observation is available. |downstream_kbps| is the downstream | 439 // a valid observation is available. |downstream_kbps| is the downstream |
| 436 // throughput in kilobits per second. | 440 // throughput in kilobits per second. |
| 437 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); | 441 void OnNewThroughputObservationAvailable(int32_t downstream_kbps); |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 connection_thresholds_[EFFECTIVE_CONNECTION_TYPE_LAST]; | 608 connection_thresholds_[EFFECTIVE_CONNECTION_TYPE_LAST]; |
| 605 | 609 |
| 606 // Latest time when the headers for a main frame request were received. | 610 // Latest time when the headers for a main frame request were received. |
| 607 base::TimeTicks last_main_frame_request_; | 611 base::TimeTicks last_main_frame_request_; |
| 608 | 612 |
| 609 // Estimated network quality when the response headers for the last mainframe | 613 // Estimated network quality when the response headers for the last mainframe |
| 610 // request were received. | 614 // request were received. |
| 611 nqe::internal::NetworkQuality estimated_quality_at_last_main_frame_; | 615 nqe::internal::NetworkQuality estimated_quality_at_last_main_frame_; |
| 612 EffectiveConnectionType effective_connection_type_at_last_main_frame_; | 616 EffectiveConnectionType effective_connection_type_at_last_main_frame_; |
| 613 | 617 |
| 618 // Estimated network quality obtained from external estimate provider when the |
| 619 // external estimate provider was last queried. |
| 620 nqe::internal::NetworkQuality external_estimate_provider_quality_; |
| 621 |
| 614 // ExternalEstimateProvider that provides network quality using operating | 622 // ExternalEstimateProvider that provides network quality using operating |
| 615 // system APIs. May be NULL. | 623 // system APIs. May be NULL. |
| 616 const std::unique_ptr<ExternalEstimateProvider> external_estimate_provider_; | 624 const std::unique_ptr<ExternalEstimateProvider> external_estimate_provider_; |
| 617 | 625 |
| 618 // Observer list for changes in effective connection type. | 626 // Observer list for changes in effective connection type. |
| 619 base::ObserverList<EffectiveConnectionTypeObserver> | 627 base::ObserverList<EffectiveConnectionTypeObserver> |
| 620 effective_connection_type_observer_list_; | 628 effective_connection_type_observer_list_; |
| 621 | 629 |
| 622 // Observer lists for round trip times and throughput measurements. | 630 // Observer lists for round trip times and throughput measurements. |
| 623 base::ObserverList<RTTObserver> rtt_observer_list_; | 631 base::ObserverList<RTTObserver> rtt_observer_list_; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 645 base::ThreadChecker thread_checker_; | 653 base::ThreadChecker thread_checker_; |
| 646 | 654 |
| 647 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 655 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| 648 | 656 |
| 649 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 657 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 650 }; | 658 }; |
| 651 | 659 |
| 652 } // namespace net | 660 } // namespace net |
| 653 | 661 |
| 654 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 662 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |