| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h
|
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h
|
| index 62e46d7f5e6052a265ce457d6de5deaaed030f82..4a452824acc4e06811b64a9677a1da0bc30af477 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h
|
| @@ -9,11 +9,14 @@
|
|
|
| #include <memory>
|
| #include <string>
|
| +#include <vector>
|
|
|
| #include "base/callback.h"
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.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/net_errors.h"
|
| @@ -25,6 +28,10 @@
|
|
|
| class GURL;
|
|
|
| +namespace base {
|
| +class SingleThreadTaskRunner;
|
| +}
|
| +
|
| namespace net {
|
| class HostPortPair;
|
| class NetLog;
|
| @@ -84,13 +91,13 @@ class DataReductionProxyConfig
|
| public:
|
| // The caller must ensure that all parameters remain alive for the lifetime
|
| // of the |DataReductionProxyConfig| instance, with the exception of
|
| - // |config_values| which is owned by |this|. |io_task_runner| is used to
|
| - // validate calls on the correct thread. |event_creator| is used for logging
|
| - // the start and end of a secure proxy check; |net_log| is used to create a
|
| - // net::BoundNetLog for correlating the start and end of the check.
|
| + // |config_values| which is owned by |this|. |event_creator| is used for
|
| + // logging the start and end of a secure proxy check; |net_log| is used to
|
| + // create a net::BoundNetLog for correlating the start and end of the check.
|
| // |config_values| contains the Data Reduction Proxy configuration values.
|
| // |configurator| is the target for a configuration update.
|
| DataReductionProxyConfig(
|
| + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
|
| net::NetLog* net_log,
|
| std::unique_ptr<DataReductionProxyConfigValues> config_values,
|
| DataReductionProxyConfigurator* configurator,
|
| @@ -200,6 +207,13 @@ class DataReductionProxyConfig
|
| virtual void GetNetworkList(net::NetworkInterfaceList* interfaces,
|
| int policy);
|
|
|
| + // Virtualized for testing. Returns the list of intervals at which accuracy of
|
| + // network quality prediction should be recorded.
|
| + virtual const std::vector<base::TimeDelta>&
|
| + GetLofiAccuracyRecordingIntervals() const;
|
| +
|
| + virtual base::TimeTicks GetTicksNow() const;
|
| +
|
| private:
|
| friend class DataReductionProxyConfigTest;
|
| friend class MockDataReductionProxyConfig;
|
| @@ -219,7 +233,9 @@ class DataReductionProxyConfig
|
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, AutoLoFiParams);
|
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest,
|
| AutoLoFiParamsSlowConnectionsFlag);
|
| - FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, AutoLoFiAccuracy);
|
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, LoFiAccuracy);
|
| + FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest,
|
| + LoFiAccuracyNonZeroDelay);
|
|
|
| // Values of the estimated network quality at the beginning of the most
|
| // recent query of the Network Quality Estimator.
|
| @@ -281,9 +297,13 @@ class DataReductionProxyConfig
|
| virtual bool IsNetworkQualityProhibitivelySlow(
|
| const net::NetworkQualityEstimator* network_quality_estimator);
|
|
|
| - // Records Lo-Fi accuracy metric.
|
| + // Records Lo-Fi accuracy metric. |measuring_duration| should belong to the
|
| + // vector returned by LofiAccuracyRecordingIntervals().
|
| + // RecordAutoLoFiAccuracyRate should be called |measuring_duration| after a
|
| + // main frame request is observed.
|
| void RecordAutoLoFiAccuracyRate(
|
| - const net::NetworkQualityEstimator* network_quality_estimator) const;
|
| + const net::NetworkQualityEstimator* network_quality_estimator,
|
| + const base::TimeDelta& measuring_duration) const;
|
|
|
| std::unique_ptr<SecureProxyChecker> secure_proxy_checker_;
|
|
|
| @@ -296,6 +316,8 @@ class DataReductionProxyConfig
|
| // Contains the configuration data being used.
|
| std::unique_ptr<DataReductionProxyConfigValues> config_values_;
|
|
|
| + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
|
| +
|
| // The caller must ensure that the |net_log_|, if set, outlives this instance.
|
| // It is used to create new instances of |bound_net_log_| on secure proxy
|
| // checks. |bound_net_log_| permits the correlation of the begin and end
|
| @@ -357,6 +379,12 @@ class DataReductionProxyConfig
|
| // request headers are never modified in the control group.
|
| bool previous_state_lofi_on_;
|
|
|
| + // Intervals after the main frame request arrives at which accuracy of network
|
| + // quality prediction is recorded.
|
| + std::vector<base::TimeDelta> lofi_accuracy_recording_intervals_;
|
| +
|
| + base::WeakPtrFactory<DataReductionProxyConfig> weak_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfig);
|
| };
|
|
|
|
|