| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h
|
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h
|
| index 648cee4ab009cf8a34cddef19823fb09236b8f48..6915e905c08fac334b96abfbe675779e1a85a939 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_service_client.h
|
| @@ -9,38 +9,93 @@
|
|
|
| #include "base/gtest_prod_util.h"
|
| #include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/timer/timer.h"
|
| +#include "net/base/backoff_entry.h"
|
| +
|
| +namespace base {
|
| +class SingleThreadTaskRunner;
|
| +}
|
|
|
| namespace data_reduction_proxy {
|
|
|
| +class DataReductionProxyConfig;
|
| +class DataReductionProxyMutableConfigValues;
|
| class DataReductionProxyParams;
|
| class DataReductionProxyRequestOptions;
|
|
|
| +// Retrieves the default net::BackoffEntry::Policy for the Data Reduction Proxy
|
| +// configuration service client.
|
| +const net::BackoffEntry::Policy& GetBackoffPolicy();
|
| +
|
| // Retrieves the Data Reduction Proxy configuration from a remote service. This
|
| // object lives on the IO thread.
|
| class DataReductionProxyConfigServiceClient {
|
| public:
|
| // The caller must ensure that all parameters remain alive for the lifetime of
|
| - // the |DataReductionProxyConfigClient|.
|
| + // the |DataReductionProxyConfigClient|, with the exception of |params|
|
| + // which this instance will own.
|
| DataReductionProxyConfigServiceClient(
|
| - DataReductionProxyParams* params,
|
| - DataReductionProxyRequestOptions* request_options);
|
| + scoped_ptr<DataReductionProxyParams> params,
|
| + const net::BackoffEntry::Policy& backoff_policy,
|
| + DataReductionProxyRequestOptions* request_options,
|
| + DataReductionProxyMutableConfigValues* config_values,
|
| + DataReductionProxyConfig* config,
|
| + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner);
|
| +
|
| + virtual ~DataReductionProxyConfigServiceClient();
|
| +
|
| + // Request the retrieval of the Data Reduction Proxy configuration.
|
| + void RetrieveConfig();
|
|
|
| - ~DataReductionProxyConfigServiceClient();
|
| + protected:
|
| + // Retrieves the backoff entry object being used to throttle request failures.
|
| + // Virtual for testing.
|
| + virtual const net::BackoffEntry* GetBackoffEntry() const;
|
| + virtual net::BackoffEntry* GetBackoffEntry();
|
| +
|
| + // Sets a timer to determine when to next refresh the Data Reduction Proxy
|
| + // configuration.
|
| + // Virtual for testing.
|
| + virtual void SetConfigRefreshTimer(const base::TimeDelta& delay);
|
| +
|
| + // Returns the current time.
|
| + // Virtual for testing.
|
| + virtual base::Time Now() const;
|
| +
|
| + // Constructs a synthetic response based on |params_|.
|
| + // Virtual for testing.
|
| + virtual std::string ConstructStaticResponse() const;
|
|
|
| private:
|
| FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigClientTest,
|
| TestConstructStaticResponse);
|
|
|
| - // Constructs a synthetic response based on |params_|.
|
| - std::string ConstructStaticResponse() const;
|
| -
|
| - // The caller must ensure that the |params_| outlives this instance.
|
| - DataReductionProxyParams* params_;
|
| + // Contains the static configuration data to use.
|
| + scoped_ptr<DataReductionProxyParams> params_;
|
|
|
| // The caller must ensure that the |request_options_| outlives this instance.
|
| DataReductionProxyRequestOptions* request_options_;
|
|
|
| + // The caller must ensure that the |config_values_| outlives this instance.
|
| + DataReductionProxyMutableConfigValues* config_values_;
|
| +
|
| + // The caller must ensure that the |config_| outlives this instance.
|
| + DataReductionProxyConfig* config_;
|
| +
|
| + // |io_task_runner_| should be the task runner for running operations on the
|
| + // IO thread.
|
| + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_;
|
| +
|
| + // Used to calculate the backoff time on request failures.
|
| + net::BackoffEntry backoff_entry_;
|
| +
|
| + // An event that fires when it is time to refresh the Data Reduction Proxy
|
| + // configuration.
|
| + base::OneShotTimer<DataReductionProxyConfigServiceClient>
|
| + config_refresh_timer_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfigServiceClient);
|
| };
|
|
|
|
|