Chromium Code Reviews| 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 6c217b2f5768bdba67c736494cee83e2629dc718..407eb923c3a8a5ce4e6465c569f1f189f7766407 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 |
| @@ -6,10 +6,13 @@ |
| #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_USAGE_STATS_H_ |
| #include "base/message_loop/message_loop_proxy.h" |
| +#include "base/prefs/pref_member.h" |
| #include "base/threading/thread_checker.h" |
| #include "components/data_reduction_proxy/browser/data_reduction_proxy_params.h" |
| #include "net/base/host_port_pair.h" |
| #include "net/base/network_change_notifier.h" |
| +#include "net/proxy/proxy_service.h" |
| +#include "net/url_request/url_request.h" |
| namespace data_reduction_proxy { |
| @@ -23,20 +26,45 @@ class DataReductionProxyUsageStats |
| base::MessageLoopProxy* io_thread_proxy); |
| virtual ~DataReductionProxyUsageStats(); |
| - /** |
| - * Callback intended to be called from |ChromeNetworkDelegate| when a |
| - * request completes. This method is used to gather usage stats. |
| - */ |
| + // Callback intended to be called from |ChromeNetworkDelegate| when a |
| + // request completes. This method is used to gather usage stats. |
| void OnUrlRequestCompleted(const net::URLRequest* request, bool started); |
| - /** |
| - * Determines whether the data reduction proxy is unreachable. |
| - * Returns true if data reduction proxy is unreachable. |
| - */ |
| + // Determines whether the data reduction proxy is unreachable. |
| + // Returns true if data reduction proxy is unreachable. |
| bool isDataReductionProxyUnreachable(); |
| + // Records the last bypass reason to |bypass_type_| and sets |
| + // |triggering_request_| to true. A triggering request is the first request to |
| + // cause the current bypass. |
| + void SetBypassType(net::ProxyService::DataReductionProxyBypassType type); |
| + |
| + // Given the |content_length| and associated |request|, records the |
| + // number of bypassed bytes for that |request| into UMAs based on bypass type. |
| + // |data_reduction_proxy_enabled| tells us the state of the |
| + // kDataReductionProxyEnabled preference. |
| + void RecordBypassedBytesHistograms( |
| + int64 content_length, |
| + const net::URLRequest& request, |
| + const BooleanPrefMember& data_reduction_proxy_enabled); |
| + |
| private: |
| + enum BypassedBytesType { |
|
Alexei Svitkine (slow)
2014/07/22 13:57:21
Mention that this is used in a histogram, so entri
megjablon
2014/07/22 18:40:46
This isn't used in the histograms, it's used to ma
Alexei Svitkine (slow)
2014/07/22 18:50:18
Okay, in that case remove the explicit values of e
megjablon
2014/07/22 21:41:45
Done.
|
| + NOT_BYPASSED = 0, /* Not bypassed. */ |
| + SSL = 1, /* Bypass due to SSL. */ |
| + LOCAL_BYPASS_RULES = 2, /* Bypass due to client-side bypass rules. */ |
| + AUDIO_VIDEO = 3, /* Audio/Video bypass. */ |
| + TRIGGERING_REQUEST = 4, /* Triggering request bypass. */ |
| + NETWORK_ERROR = 5, /* Network error. */ |
| + BYPASSED_BYTES_TYPE_MAX = 6 /*This must always be last.*/ |
|
bengr
2014/07/22 16:59:44
Add a space in the comment.
megjablon
2014/07/22 18:40:46
Done.
|
| + }; |
| + |
| DataReductionProxyParams* data_reduction_proxy_params_; |
| + // The last reason for bypass as determined by |
| + // MaybeBypassProxyAndPrepareToRetry |
| + net::ProxyService::DataReductionProxyBypassType last_bypass_type_; |
| + // True if the last request triggered the current bypass. |
| + bool triggering_request_; |
| base::MessageLoopProxy* ui_thread_proxy_; |
| base::MessageLoopProxy* io_thread_proxy_; |
| @@ -63,6 +91,11 @@ class DataReductionProxyUsageStats |
| base::ThreadChecker thread_checker_; |
| + void RecordBypassedBytes( |
| + net::ProxyService::DataReductionProxyBypassType bypass_type, |
| + BypassedBytesType bypassed_bytes_type, |
| + int64 content_length); |
| + |
| DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats); |
| }; |