Chromium Code Reviews| 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..88da9b27743b50b5046368b8ba820bbcf6c55250 100644 |
| --- a/net/base/network_quality_estimator.h |
| +++ b/net/base/network_quality_estimator.h |
| @@ -14,6 +14,7 @@ |
| #include "base/gtest_prod_util.h" |
| #include "base/macros.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/threading/thread_checker.h" |
| #include "base/time/time.h" |
| #include "net/base/external_estimate_provider.h" |
| @@ -140,6 +141,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 +347,20 @@ 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; |
| + // Queries the external estimate provider for the latest network quality |
| + // estimates, and adds those estimates to the current observation buffer. |
| + void QueryExternalEstimateProvider(); |
| + |
| + // Called when the posted task to query external estimate provider is ran. |
| + void RunExternalEstimateProviderDelayedTask(); |
| // Obtains operating parameters from the field trial parameters. |
| void ObtainOperatingParams( |
| @@ -432,8 +444,30 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| // system APIs. May be NULL. |
| const scoped_ptr<ExternalEstimateProvider> external_estimates_provider_; |
| + // Time when the external estimate provider (eep) was last queried. |
| + base::TimeTicks eep_queried_; |
| + |
| + // True if a delayed task querying the external estimate provider has been |
| + // posted. |
| + bool eep_delayed_task_posted_; |
|
bengr
2015/09/02 20:27:56
How about external_estimate_pending_?
tbansal1
2015/09/03 00:22:40
Done.
|
| + |
| + // 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_; |
| + // Used for posting tasks. |
| + base::WeakPtrFactory<NetworkQualityEstimator> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| }; |