Index: components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
index 33fd29e560fa2f533fa044f1c3be60a83537c599..fd956efcecb99a0c84aea76d43bdf56a7d4c0220 100644 |
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.h |
@@ -64,8 +64,10 @@ class DataReductionProxyUsageStats |
const BooleanPrefMember& data_reduction_proxy_enabled, |
const net::ProxyConfig& data_reduction_proxy_config); |
- void RecordBypassEventHistograms(const net::ProxyServer& bypassed_proxy, |
- int net_error) const; |
+ // Called by |ChromeNetworkDelegate| when a proxy is put into the bad proxy |
+ // list. Used to track when the data reduction proxy falls back. |
+ void OnProxyFallback(const net::ProxyServer& bypassed_proxy, |
+ int net_error); |
private: |
enum BypassedBytesType { |
@@ -83,9 +85,11 @@ class DataReductionProxyUsageStats |
virtual void OnNetworkChanged( |
net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
- // Counts requests that went through the data reduction proxy and counts |
- // requests that were eligible to go through the proxy. |
- void IncrementRequestCounts(bool actual); |
+ // Called when request counts change. Resets counts if they exceed thresholds, |
+ // and calls MaybeNotifyUnavailability otherwise. |
+ void OnRequestCountChanged(); |
+ |
+ // Clears request counts unconditionally. |
void ClearRequestCounts(); |
// Checks if the availability status of the data reduction proxy has changed, |
@@ -93,7 +97,7 @@ class DataReductionProxyUsageStats |
// data reduction proxy is considered unavailable if and only if no requests |
// went through the proxy but some eligible requests were service by other |
// routes. |
- void MaybeNotifyUnavailability(); |
+ void NotifyUnavailabilityIfChanged(); |
void NotifyUnavailabilityOnUIThread(bool unavailable); |
DataReductionProxyParams* data_reduction_proxy_params_; |
@@ -110,14 +114,12 @@ class DataReductionProxyUsageStats |
// unreachable if no successful requests are made through it despite a |
// non-zero number of requests being eligible. |
- // Count of requests which will be tried to be sent through data reduction |
- // proxy. The count is only based on the config and not the bad proxy list. |
- // Explicit bypasses are not part of this count. This is the desired behavior |
- // since otherwise both counts would be identical. |
- unsigned long eligible_num_requests_through_proxy_; |
+ // Count of successful requests through the data reduction proxy. |
+ unsigned long successful_requests_through_proxy_count_; |
- // Count of successful requests through data reduction proxy. |
- unsigned long actual_num_requests_through_proxy_; |
+ // Count of network errors encountered when connecting to a data reduction |
+ // proxy. |
+ unsigned long proxy_net_errors_count_; |
// Whether or not the data reduction proxy is unavailable. |
bool unavailable_; |