Index: net/base/network_quality_estimator.h |
diff --git a/net/base/network_quality_estimator.h b/net/base/network_quality_estimator.h |
index e244eb3d3763ceb7ecd8497fa9f5b9f6d6bc6e90..f3b79997fbd688f18446b905966c1e19f6a78a78 100644 |
--- a/net/base/network_quality_estimator.h |
+++ b/net/base/network_quality_estimator.h |
@@ -48,12 +48,12 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
// Returns true if RTT is available and sets |rtt| to estimated RTT. |
// Virtualized for testing. |rtt| should not be null. |
- virtual bool GetRTTEstimate(base::TimeDelta* rtt) const; |
+ virtual bool GetRTTEstimate(base::TimeDelta* rtt); |
// Returns true if downlink throughput is available and sets |kbps| to |
// estimated downlink throughput (in Kilobits per second). |
// Virtualized for testing. |kbps| should not be null. |
- virtual bool GetDownlinkThroughputKbpsEstimate(int32_t* kbps) const; |
+ virtual bool GetDownlinkThroughputKbpsEstimate(int32_t* kbps); |
// Notifies NetworkQualityEstimator that the response header of |request| has |
// been received. |
@@ -67,14 +67,14 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
// RTT observations since |begin_timestamp|. |
// Virtualized for testing. |rtt| should not be null. |
virtual bool GetRecentMedianRTT(const base::TimeTicks& begin_timestamp, |
- base::TimeDelta* rtt) const; |
+ base::TimeDelta* rtt); |
// Returns true if median downstream throughput is available and sets |kbps| |
// to the median of downstream Kbps observations since |begin_timestamp|. |
// Virtualized for testing. |kbps| should not be null. |
virtual bool GetRecentMedianDownlinkThroughputKbps( |
const base::TimeTicks& begin_timestamp, |
- int32_t* kbps) const; |
+ int32_t* kbps); |
protected: |
// NetworkID is used to uniquely identify a network. |
@@ -140,6 +140,9 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
void OnConnectionTypeChanged( |
NetworkChangeNotifier::ConnectionType type) override; |
+ // ExternalEstimateProvider::UpdatedEstimateObserver implementation. |
+ void OnUpdatedEstimateAvailable() override; |
+ |
private: |
FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestKbpsRTTUpdates); |
@@ -343,12 +346,22 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
// Maximum number of observations that can be held in the ObservationBuffer. |
static const size_t kMaximumObservationsBufferSize = 300; |
+ // Minimum time duration (in milliseconds) between consecutive queries to |
+ // external estimate provider. |
+ static const int kExternalEstimateProviderQueryIntervalMsec = 5 * 60 * 1000; |
+ |
// Returns the RTT value to be used when the valid RTT is unavailable. Readers |
// should discard RTT if it is set to the value returned by |InvalidRTT()|. |
static const base::TimeDelta InvalidRTT(); |
- // ExternalEstimateProvider::UpdatedEstimateObserver implementation. |
- void OnUpdatedEstimateAvailable() override; |
+ // May call |QueryExternalEstimateProvider| if the most recent call to |
+ // external estimate provider was more than |
+ // |kExternalEstimateProviderQueryIntervalMsec| back. |
+ void MaybeQueryExternalEstimateProvider(); |
+ |
+ // Queries the external estimate provider for the latest network quality |
+ // estimates, and adds those estimates to the current observation buffer. |
+ void QueryExternalEstimateProvider(); |
// Obtains operating parameters from the field trial parameters. |
void ObtainOperatingParams( |
@@ -430,7 +443,22 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
// ExternalEstimateProvider that provides network quality using operating |
// system APIs. May be NULL. |
- const scoped_ptr<ExternalEstimateProvider> external_estimates_provider_; |
+ const scoped_ptr<ExternalEstimateProvider> external_estimate_provider_; |
+ |
+ // Time when the external estimate provider was last queried. |
+ base::TimeTicks external_estimate_request_time_; |
+ |
+ // Values of external estimate provider status. |
bengr
2015/09/08 18:14:23
Move the next line up and fill out to 80 character
tbansal1
2015/09/08 21:25:55
Done.
|
+ // This enum must remain synchronized with the enum of the same name in |
+ // metrics/histograms/histograms.xml. |
+ enum NQEExternalEstimateProviderStatus { |
+ EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE, |
+ EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE, |
+ EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED, |
+ EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL, |
+ EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK, |
+ EXTERNAL_ESTIMATE_PROVIDER_STATUS_BOUNDARY |
+ }; |
base::ThreadChecker thread_checker_; |