Chromium Code Reviews| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc |
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc |
| index 684c4ee1f97aa921f2c4d9730efafa8f32f98b0f..53ac063873ad0d55fff99e910a3d4cdaf88f6f50 100644 |
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc |
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc |
| @@ -6,10 +6,11 @@ |
| #include "base/bind.h" |
| #include "base/callback.h" |
| -#include "base/message_loop/message_loop_proxy.h" |
| #include "base/metrics/histogram.h" |
| #include "base/metrics/sparse_histogram.h" |
| #include "base/prefs/pref_member.h" |
| +#include "base/single_thread_task_runner.h" |
| +#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.h" |
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_tamper_detection.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" |
| @@ -103,11 +104,13 @@ void DataReductionProxyUsageStats::DetectAndRecordMissingViaHeaderResponseCode( |
| DataReductionProxyUsageStats::DataReductionProxyUsageStats( |
| DataReductionProxyParams* params, |
| - const scoped_refptr<MessageLoopProxy>& ui_thread_proxy) |
| + DataReductionProxySettings* settings, |
| + const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner) |
| : data_reduction_proxy_params_(params), |
| + settings_(settings), |
| last_bypass_type_(BYPASS_EVENT_TYPE_MAX), |
| triggering_request_(true), |
| - ui_thread_proxy_(ui_thread_proxy), |
| + ui_task_runner_(ui_task_runner), |
| successful_requests_through_proxy_count_(0), |
| proxy_net_errors_count_(0), |
| unavailable_(false) { |
| @@ -175,7 +178,7 @@ void DataReductionProxyUsageStats::NotifyUnavailabilityIfChanged() { |
| successful_requests_through_proxy_count_ <= |
| kMaxSuccessfulRequestsWhenUnavailable); |
| if (prev_unavailable != unavailable_) { |
| - ui_thread_proxy_->PostTask(FROM_HERE, base::Bind( |
| + ui_task_runner_->PostTask(FROM_HERE, base::Bind( |
| &DataReductionProxyUsageStats::NotifyUnavailabilityOnUIThread, |
| base::Unretained(this), |
| unavailable_)); |
| @@ -184,9 +187,9 @@ void DataReductionProxyUsageStats::NotifyUnavailabilityIfChanged() { |
| void DataReductionProxyUsageStats::NotifyUnavailabilityOnUIThread( |
| bool unavailable) { |
| - DCHECK(ui_thread_proxy_->BelongsToCurrentThread()); |
| - if (!unavailable_callback_.is_null()) |
| - unavailable_callback_.Run(unavailable); |
| + DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
| + if (settings_) |
|
sclittle
2015/01/14 22:54:47
When would this ever be null? Also, why not move t
bengr
2015/01/15 00:30:32
Done.
|
| + settings_->SetUnreachable(unavailable); |
| } |
| void DataReductionProxyUsageStats::SetBypassType( |