| Index: net/base/network_quality_estimator.h
|
| diff --git a/net/base/network_quality_estimator.h b/net/base/network_quality_estimator.h
|
| index ecfa08af6b8341b3a9bb06897a89baa42651c7b7..fca08243e0798a0b740a17d2fa3d1b69ce1a8aed 100644
|
| --- a/net/base/network_quality_estimator.h
|
| +++ b/net/base/network_quality_estimator.h
|
| @@ -7,6 +7,8 @@
|
|
|
| #include <stdint.h>
|
|
|
| +#include <deque>
|
| +
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/threading/thread_checker.h"
|
| @@ -33,21 +35,38 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
|
|
| ~NetworkQualityEstimator() override;
|
|
|
| - // Returns an estimate of the current network quality.
|
| - NetworkQuality GetEstimate() const;
|
| + // Returns the peak estimates (fastest RTT and peak throughput) of the
|
| + // current network.
|
| + NetworkQuality GetPeakEstimate() const;
|
|
|
| // Notifies NetworkQualityEstimator that a response has been received.
|
| - // |prefilter_bytes_read| is the count of the bytes received prior to
|
| - // applying filters (e.g. decompression, SDCH) from request creation time
|
| + // |cummulative_prefilter_bytes_read| is the count of the bytes received prior
|
| + // to applying filters (e.g. decompression, SDCH) from request creation time
|
| // until now.
|
| + // |prefiltered_bytes_read| is the count of the bytes received prior
|
| + // to applying filters in the most recent read.
|
| void NotifyDataReceived(const URLRequest& request,
|
| - int64_t prefilter_bytes_read);
|
| + int64_t cummulative_prefilter_bytes_read,
|
| + int64_t prefiltered_bytes_read);
|
|
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
|
| TestPeakKbpsFastestRTTUpdates);
|
| FRIEND_TEST_ALL_PREFIXES(URLRequestTestHTTP, NetworkQualityEstimator);
|
|
|
| + // Sample is used to store RTT and Kbps samples in buffers. A sample has a
|
| + // value and a timestamp (when the sample was taken).
|
| + class Sample {
|
| + public:
|
| + explicit Sample(int value);
|
| +
|
| + // Value of the sample.
|
| + const int value_;
|
| +
|
| + // Time when the sample was taken.
|
| + const base::TimeTicks timestamp_;
|
| + };
|
| +
|
| // Tiny transfer sizes may give inaccurate throughput results.
|
| // Minimum size of the transfer over which the throughput is computed.
|
| static const int kMinTransferSizeInBytes = 10000;
|
| @@ -93,6 +112,14 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
|
| // 2) The transfer time includes at least one RTT while no bytes are read.
|
| uint64_t peak_kbps_since_last_connection_change_;
|
|
|
| + // Buffer that holds Kbps samples sorted by time.
|
| + // Oldest sample is at the front of the queue.
|
| + std::deque<Sample> kbps_;
|
| +
|
| + // Buffer that holds RTT (in milliseconds) samples sorted by time.
|
| + // Oldest sample is at the front of the queue.
|
| + std::deque<Sample> rtt_msec_;
|
| +
|
| base::ThreadChecker thread_checker_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
|
|
|