Chromium Code Reviews| 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..46a93e0d25366e20f7dd859618cd357a7e74a565 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,13 @@ |
| #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/weak_ptr.h" |
| #include "base/threading/thread_checker.h" |
| #include "base/time/time.h" |
| #include "net/base/net_errors.h" |
| @@ -25,6 +27,11 @@ |
| class GURL; |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +class TickClock; |
| +} |
| + |
| 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>& |
| + lofi_accuracy_recording_intervals() const; |
| + |
| + virtual base::TickClock* GetTickClock() 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. |
| @@ -283,7 +299,8 @@ class DataReductionProxyConfig |
| // Records Lo-Fi accuracy metric. |
|
Alexei Svitkine (slow)
2016/04/18 20:35:09
Add a comment about measuring_duration. Per histog
tbansal1
2016/04/18 22:37:35
Done.
|
| 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 +313,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 +376,14 @@ 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_; |
| + |
| + scoped_ptr<base::TickClock> tick_clock_; |
| + |
| + base::WeakPtrFactory<DataReductionProxyConfig> weak_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfig); |
| }; |