| Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
|
| diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
|
| index bef98bf0bea26a075368a4912ea803f8f0d0669a..e56e5701527fdf8532d9159976467df4c6ff65cc 100644
|
| --- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
|
| +++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc
|
| @@ -4,12 +4,10 @@
|
|
|
| #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.h"
|
|
|
| -#include "base/bind.h"
|
| #include "base/callback.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_config.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"
|
| @@ -104,28 +102,24 @@ void DataReductionProxyBypassStats::DetectAndRecordMissingViaHeaderResponseCode(
|
|
|
| DataReductionProxyBypassStats::DataReductionProxyBypassStats(
|
| DataReductionProxyConfig* config,
|
| - UnreachableCallback unreachable_callback,
|
| - const scoped_refptr<base::SingleThreadTaskRunner>& ui_task_runner)
|
| + UnreachableCallback unreachable_callback)
|
| : data_reduction_proxy_config_(config),
|
| unreachable_callback_(unreachable_callback),
|
| last_bypass_type_(BYPASS_EVENT_TYPE_MAX),
|
| triggering_request_(true),
|
| - ui_task_runner_(ui_task_runner),
|
| successful_requests_through_proxy_count_(0),
|
| proxy_net_errors_count_(0),
|
| unavailable_(false) {
|
| DCHECK(config);
|
| NetworkChangeNotifier::AddNetworkChangeObserver(this);
|
| -};
|
| +}
|
|
|
| DataReductionProxyBypassStats::~DataReductionProxyBypassStats() {
|
| NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
|
| -};
|
| +}
|
|
|
| void DataReductionProxyBypassStats::OnUrlRequestCompleted(
|
| const net::URLRequest* request, bool started) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| -
|
| DataReductionProxyTypeInfo proxy_info;
|
| // Ignore requests that did not use the data reduction proxy. The check for
|
| // LOAD_BYPASS_PROXY is necessary because the proxy_server() in the |request|
|
| @@ -358,12 +352,10 @@ void DataReductionProxyBypassStats::RecordMissingViaHeaderBytes(
|
|
|
| void DataReductionProxyBypassStats::OnNetworkChanged(
|
| NetworkChangeNotifier::ConnectionType type) {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| ClearRequestCounts();
|
| }
|
|
|
| void DataReductionProxyBypassStats::ClearRequestCounts() {
|
| - DCHECK(thread_checker_.CalledOnValidThread());
|
| successful_requests_through_proxy_count_ = 0;
|
| proxy_net_errors_count_ = 0;
|
| }
|
| @@ -374,18 +366,8 @@ void DataReductionProxyBypassStats::NotifyUnavailabilityIfChanged() {
|
| (proxy_net_errors_count_ >= kMinFailedRequestsWhenUnavailable &&
|
| successful_requests_through_proxy_count_ <=
|
| kMaxSuccessfulRequestsWhenUnavailable);
|
| - if (prev_unavailable != unavailable_) {
|
| - ui_task_runner_->PostTask(FROM_HERE, base::Bind(
|
| - &DataReductionProxyBypassStats::NotifyUnavailabilityOnUIThread,
|
| - base::Unretained(this),
|
| - unavailable_));
|
| - }
|
| -}
|
| -
|
| -void DataReductionProxyBypassStats::NotifyUnavailabilityOnUIThread(
|
| - bool unavailable) {
|
| - DCHECK(ui_task_runner_->BelongsToCurrentThread());
|
| - unreachable_callback_.Run(unavailable);
|
| + if (prev_unavailable != unavailable_)
|
| + unreachable_callback_.Run(unavailable_);
|
| }
|
|
|
| void DataReductionProxyBypassStats::RecordBypassedBytes(
|
|
|