| Index: net/base/network_quality_estimator.h
|
| diff --git a/net/base/network_quality_estimator.h b/net/base/network_quality_estimator.h
|
| index aba0313b6ec924c68376ced83ecd7eeb5391c207..65cab569a43c87367dac88779470689e78dd854b 100644
|
| --- a/net/base/network_quality_estimator.h
|
| +++ b/net/base/network_quality_estimator.h
|
| @@ -51,12 +51,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.
|
| @@ -70,14 +70,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);
|
|
|
| // SocketPerformanceWatcherFactory implementation:
|
| scoped_ptr<SocketPerformanceWatcher> CreateTCPSocketPerformanceWatcher()
|
| @@ -149,6 +149,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);
|
| @@ -352,12 +355,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(
|
| @@ -439,7 +452,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. 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_;
|
|
|
|
|