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..e6f60a7429c66cca17f40e8d7899b86e7254b519 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,12 @@ |
| #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" |
| namespace data_reduction_proxy { |
| @@ -23,20 +25,49 @@ 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. |
| + void SetBypassType(net::ProxyService::DataReductionProxyBypassType type); |
| + |
| + // Records the number of bypassed bytes for various bypass reasons into their |
| + // respective UMAs. |
| + void RecordBypassedBytesHistograms( |
| + const int64 content_length, |
|
Alexei Svitkine (slow)
2014/07/15 18:20:08
Nit: No need for const on primitives.
Also, is th
|
| + const net::URLRequest* request, |
|
Alexei Svitkine (slow)
2014/07/15 18:20:08
If |request| can never be NULL, which seems to be
megjablon
2014/07/16 00:00:59
Done.
|
| + const BooleanPrefMember* data_reduction_proxy_enabled); |
| + |
| private: |
| + enum DataReductionProxyBypassedBytesType { |
| + // Not bypassed. |
| + NOT_BYPASSED = 0, |
| + |
| + // Bypass due to SSL. |
| + SSL, |
| + |
| + // Bypass due to client-side bypass rules. |
| + LOCAL_BYPASS_RULES, |
| + |
| + // Audio/Video bypass. |
| + AUDIO_VIDEO, |
| + |
| + // Triggering request bypass. |
| + TRIGGERING_REQUEST, |
| + |
| + // This must always be last. |
| + BYPASSED_BYTES_TYPE_MAX |
| + }; |
| + |
| DataReductionProxyParams* data_reduction_proxy_params_; |
| + net::ProxyService::DataReductionProxyBypassType bypass_type_; |
| + bool triggering_request_; |
| base::MessageLoopProxy* ui_thread_proxy_; |
| base::MessageLoopProxy* io_thread_proxy_; |
| @@ -63,6 +94,16 @@ class DataReductionProxyUsageStats |
| base::ThreadChecker thread_checker_; |
| + void RecordTriggeringRequestBypassedBytes( |
| + net::ProxyService::DataReductionProxyBypassType bypass_type, |
| + int64 content_length); |
| + void RecordNetworkErrorBypassedBytes(const net::URLRequest* request, |
|
Alexei Svitkine (slow)
2014/07/15 18:20:08
Nit: Pass by const ref?
megjablon
2014/07/16 00:00:59
We moved this logic into RecordBypassedBytes, dele
|
| + int64 content_length); |
| + void RecordBypassedBytes( |
| + net::ProxyService::DataReductionProxyBypassType bypass_type, |
| + DataReductionProxyBypassedBytesType bypassed_bytes_type, |
| + int64 content_length); |
| + |
| DISALLOW_COPY_AND_ASSIGN(DataReductionProxyUsageStats); |
| }; |