Index: components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc |
diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc |
index a7426f564aa2f52108810a20e8f119c043b35cf3..adda1d3746ef8a2c2259d72cc08cd2877898e4ca 100644 |
--- a/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc |
+++ b/components/data_reduction_proxy/browser/data_reduction_proxy_usage_stats.cc |
@@ -9,11 +9,8 @@ |
#include "base/message_loop/message_loop_proxy.h" |
#include "base/metrics/histogram.h" |
#include "base/metrics/sparse_histogram.h" |
-#include "base/prefs/pref_member.h" |
#include "components/data_reduction_proxy/common/data_reduction_proxy_headers.h" |
#include "net/base/net_errors.h" |
-#include "net/http/http_response_headers.h" |
-#include "net/http/http_status_code.h" |
#include "net/proxy/proxy_retry_info.h" |
#include "net/proxy/proxy_server.h" |
#include "net/proxy/proxy_service.h" |
@@ -79,26 +76,6 @@ void DataReductionProxyUsageStats::RecordDataReductionProxyBypassInfo( |
} |
} |
-// static |
-void DataReductionProxyUsageStats::DetectAndRecordMissingViaHeaderResponseCode( |
- bool is_primary, |
- const net::HttpResponseHeaders* headers) { |
- if (HasDataReductionProxyViaHeader(headers, NULL)) { |
- // The data reduction proxy via header is present, so don't record anything. |
- return; |
- } |
- |
- if (is_primary) { |
- UMA_HISTOGRAM_SPARSE_SLOWLY( |
- "DataReductionProxy.MissingViaHeader.ResponseCode.Primary", |
- headers->response_code()); |
- } else { |
- UMA_HISTOGRAM_SPARSE_SLOWLY( |
- "DataReductionProxy.MissingViaHeader.ResponseCode.Fallback", |
- headers->response_code()); |
- } |
-} |
- |
DataReductionProxyUsageStats::DataReductionProxyUsageStats( |
DataReductionProxyParams* params, |
const scoped_refptr<MessageLoopProxy>& ui_thread_proxy) |
@@ -168,31 +145,22 @@ void DataReductionProxyUsageStats::SetBypassType( |
triggering_request_ = true; |
} |
-void DataReductionProxyUsageStats::RecordBytesHistograms( |
- net::URLRequest* request, |
- const BooleanPrefMember& data_reduction_proxy_enabled, |
- const net::ProxyConfig& data_reduction_proxy_config) { |
- RecordBypassedBytesHistograms(request, data_reduction_proxy_enabled, |
- data_reduction_proxy_config); |
- RecordMissingViaHeaderBytes(request); |
-} |
- |
void DataReductionProxyUsageStats::RecordBypassedBytesHistograms( |
- net::URLRequest* request, |
+ net::URLRequest& request, |
const BooleanPrefMember& data_reduction_proxy_enabled, |
const net::ProxyConfig& data_reduction_proxy_config) { |
- int64 content_length = request->received_response_content_length(); |
+ int64 content_length = request.received_response_content_length(); |
if (data_reduction_proxy_enabled.GetValue() && |
!data_reduction_proxy_config.Equals( |
- request->context()->proxy_service()->config())) { |
+ request.context()->proxy_service()->config())) { |
RecordBypassedBytes(last_bypass_type_, |
DataReductionProxyUsageStats::MANAGED_PROXY_CONFIG, |
content_length); |
return; |
} |
- if (data_reduction_proxy_params_->WasDataReductionProxyUsed(request, NULL)) { |
+ if (data_reduction_proxy_params_->WasDataReductionProxyUsed(&request, NULL)) { |
RecordBypassedBytes(last_bypass_type_, |
DataReductionProxyUsageStats::NOT_BYPASSED, |
content_length); |
@@ -200,7 +168,7 @@ void DataReductionProxyUsageStats::RecordBypassedBytesHistograms( |
} |
if (data_reduction_proxy_enabled.GetValue() && |
- request->url().SchemeIs(url::kHttpsScheme)) { |
+ request.url().SchemeIs(url::kHttpsScheme)) { |
RecordBypassedBytes(last_bypass_type_, |
DataReductionProxyUsageStats::SSL, |
content_length); |
@@ -209,7 +177,7 @@ void DataReductionProxyUsageStats::RecordBypassedBytesHistograms( |
if (data_reduction_proxy_enabled.GetValue() && |
data_reduction_proxy_params_->IsBypassedByDataReductionProxyLocalRules( |
- *request, data_reduction_proxy_config)) { |
+ request, data_reduction_proxy_config)) { |
RecordBypassedBytes(last_bypass_type_, |
DataReductionProxyUsageStats::LOCAL_BYPASS_RULES, |
content_length); |
@@ -223,7 +191,7 @@ void DataReductionProxyUsageStats::RecordBypassedBytesHistograms( |
last_bypass_type_ == BYPASS_EVENT_TYPE_MEDIUM || |
last_bypass_type_ == BYPASS_EVENT_TYPE_LONG)) { |
std::string mime_type; |
- request->GetMimeType(&mime_type); |
+ request.GetMimeType(&mime_type); |
// MIME types are named by <media-type>/<subtype>. Check to see if the |
// media type is audio or video. Only record when triggered by short bypass, |
// there isn't an audio or video bucket for medium or long bypasses. |
@@ -250,7 +218,7 @@ void DataReductionProxyUsageStats::RecordBypassedBytesHistograms( |
return; |
} |
- if (data_reduction_proxy_params_->AreDataReductionProxiesBypassed(*request, |
+ if (data_reduction_proxy_params_->AreDataReductionProxiesBypassed(request, |
NULL)) { |
RecordBypassedBytes(last_bypass_type_, |
DataReductionProxyUsageStats::NETWORK_ERROR, |
@@ -410,30 +378,6 @@ void DataReductionProxyUsageStats::RecordBypassedBytes( |
} |
} |
-void DataReductionProxyUsageStats::RecordMissingViaHeaderBytes( |
- URLRequest* request) { |
- // Responses that were served from cache should have been filtered out |
- // already. |
- DCHECK(!request->was_cached()); |
- |
- if (!data_reduction_proxy_params_->WasDataReductionProxyUsed(request, NULL) || |
- HasDataReductionProxyViaHeader(request->response_headers(), NULL)) { |
- // Only track requests that used the data reduction proxy and had responses |
- // that were missing the data reduction proxy via header. |
- return; |
- } |
- |
- if (request->GetResponseCode() >= net::HTTP_BAD_REQUEST && |
- request->GetResponseCode() < net::HTTP_INTERNAL_SERVER_ERROR) { |
- // Track 4xx responses that are missing via headers separately. |
- UMA_HISTOGRAM_COUNTS("DataReductionProxy.MissingViaHeader.Bytes.4xx", |
- request->received_response_content_length()); |
- } else { |
- UMA_HISTOGRAM_COUNTS("DataReductionProxy.MissingViaHeader.Bytes.Other", |
- request->received_response_content_length()); |
- } |
-} |
- |
} // namespace data_reduction_proxy |