Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_bypass_stats.cc

Issue 1006583002: Reset unreachable data reduction proxy message when data savings is toggled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Vector initialization. Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 d17965717789f81b9ab2ff0ddeee247157e30a14..1664cc1862a7728e07bba4959340181456c6ec08 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
@@ -223,6 +223,21 @@ void DataReductionProxyBypassStats::OnConnectComplete(
}
}
+void DataReductionProxyBypassStats::ClearRequestCounts() {
+ successful_requests_through_proxy_count_ = 0;
+ proxy_net_errors_count_ = 0;
+}
+
+void DataReductionProxyBypassStats::NotifyUnavailabilityIfChanged() {
+ bool prev_unavailable = unavailable_;
+ unavailable_ =
+ (proxy_net_errors_count_ >= kMinFailedRequestsWhenUnavailable &&
+ successful_requests_through_proxy_count_ <=
+ kMaxSuccessfulRequestsWhenUnavailable);
+ if (prev_unavailable != unavailable_)
+ unreachable_callback_.Run(unavailable_);
+}
+
void DataReductionProxyBypassStats::RecordBypassedBytesHistograms(
const net::URLRequest& request,
bool data_reduction_proxy_enabled,
@@ -365,21 +380,6 @@ void DataReductionProxyBypassStats::OnNetworkChanged(
ClearRequestCounts();
}
-void DataReductionProxyBypassStats::ClearRequestCounts() {
- successful_requests_through_proxy_count_ = 0;
- proxy_net_errors_count_ = 0;
-}
-
-void DataReductionProxyBypassStats::NotifyUnavailabilityIfChanged() {
- bool prev_unavailable = unavailable_;
- unavailable_ =
- (proxy_net_errors_count_ >= kMinFailedRequestsWhenUnavailable &&
- successful_requests_through_proxy_count_ <=
- kMaxSuccessfulRequestsWhenUnavailable);
- if (prev_unavailable != unavailable_)
- unreachable_callback_.Run(unavailable_);
-}
-
void DataReductionProxyBypassStats::RecordBypassedBytes(
DataReductionProxyBypassType bypass_type,
DataReductionProxyBypassStats::BypassedBytesType bypassed_bytes_type,

Powered by Google App Engine
This is Rietveld 408576698