Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h |
| index 33502e9c1896a5ddf9c4e2d91c335ad7be56751f..057a8ca50e5d0c9fabf82a588cdf40ac34dc59d0 100644 |
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h |
| @@ -6,8 +6,8 @@ |
| #define COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS_H_ |
| #include "base/callback.h" |
| -#include "base/message_loop/message_loop_proxy.h" |
| #include "base/prefs/pref_member.h" |
| +#include "base/single_thread_task_runner.h" |
| #include "base/threading/thread_checker.h" |
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_headers.h" |
| #include "components/data_reduction_proxy/core/common/data_reduction_proxy_params.h" |
| @@ -23,6 +23,8 @@ class ProxyServer; |
| namespace data_reduction_proxy { |
| +class DataReductionProxySettings; |
| + |
| class DataReductionProxyUsageStats |
| : public net::NetworkChangeNotifier::NetworkChangeObserver { |
| public: |
| @@ -43,18 +45,15 @@ class DataReductionProxyUsageStats |
| const net::HttpResponseHeaders* headers); |
| // MessageLoopProxy instance is owned by io_thread. |params| outlives |
|
sclittle
2015/01/15 02:18:56
Where's the MessageLoopProxy instance?
bengr
2015/01/17 00:20:48
Done.
|
| - // this class instance. |
| + // this class instance. |settings| provides a hook to inform the user that the |
| + // Data Reduction Proxy is unreachable, which occurs on the UI thread, hence |
| + // the |ui_task_runner|. |settings| and |params| must not be null. |
| DataReductionProxyUsageStats( |
| DataReductionProxyParams* params, |
| - const scoped_refptr<base::MessageLoopProxy>& ui_thread_proxy); |
| - ~DataReductionProxyUsageStats() override; |
| + DataReductionProxySettings* settings, |
| + const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner); |
| - // Sets the callback to be called on the UI thread when the unavailability |
| - // status has changed. |
| - void set_unavailable_callback( |
| - const base::Callback<void(bool)>& unavailable_callback) { |
| - unavailable_callback_ = unavailable_callback; |
| - } |
| + ~DataReductionProxyUsageStats() override; |
| // Callback intended to be called from |ChromeNetworkDelegate| when a |
|
sclittle
2015/01/15 02:18:56
nit: DataReductionProxyNetworkDelegate, not Chrome
bengr
2015/01/17 00:20:48
Done.
|
| // request completes. This method is used to gather usage stats. |
| @@ -119,10 +118,6 @@ class DataReductionProxyUsageStats |
| void OnNetworkChanged( |
| net::NetworkChangeNotifier::ConnectionType type) override; |
| - // Called when request counts change. Resets counts if they exceed thresholds, |
| - // and calls MaybeNotifyUnavailability otherwise. |
| - void OnRequestCountChanged(); |
| - |
| // Clears request counts unconditionally. |
| void ClearRequestCounts(); |
| @@ -134,13 +129,21 @@ class DataReductionProxyUsageStats |
| void NotifyUnavailabilityIfChanged(); |
| void NotifyUnavailabilityOnUIThread(bool unavailable); |
| + void RecordBypassedBytes( |
| + DataReductionProxyBypassType bypass_type, |
| + BypassedBytesType bypassed_bytes_type, |
| + int64 content_length); |
| + |
| DataReductionProxyParams* data_reduction_proxy_params_; |
| + |
| + DataReductionProxySettings* settings_; |
| + |
| // The last reason for bypass as determined by |
| // MaybeBypassProxyAndPrepareToRetry |
| DataReductionProxyBypassType last_bypass_type_; |
| // True if the last request triggered the current bypass. |
| bool triggering_request_; |
| - const scoped_refptr<base::MessageLoopProxy> ui_thread_proxy_; |
| + const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| // The following 2 fields are used to determine if data reduction proxy is |
| // unreachable. We keep a count of requests which should go through |
| @@ -160,14 +163,6 @@ class DataReductionProxyUsageStats |
| base::ThreadChecker thread_checker_; |
| - void RecordBypassedBytes( |
| - DataReductionProxyBypassType bypass_type, |
| - BypassedBytesType bypassed_bytes_type, |
| - int64 content_length); |
| - |
| - // Called when the unavailability status has changed. Runs on the UI thread. |
| - base::Callback<void(bool)> unavailable_callback_; |
| - |
| DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats); |
| }; |