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

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

Issue 792803007: Make Data Reduction Proxy a best effort proxy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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_usage_stats.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
index 907e9cf1259824ceeaef7b7ed8ae1679534a7be7..ddd9b1f56c572b1ee8881e81774aaad269b4990a 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.cc
@@ -215,14 +215,15 @@ void DataReductionProxyUsageStats::RecordBypassedBytesHistograms(
const net::ProxyConfig& data_reduction_proxy_config) {
int64 content_length = request->received_response_content_length();
- if (data_reduction_proxy_enabled.GetValue() &&
- !data_reduction_proxy_config.Equals(
- request->context()->proxy_service()->config())) {
- RecordBypassedBytes(last_bypass_type_,
- DataReductionProxyUsageStats::MANAGED_PROXY_CONFIG,
- content_length);
+
+ // Only record histograms when the data reduction proxy is enabled.
+ if (!data_reduction_proxy_enabled.GetValue())
+ return;
+
+ // TODO(bengr): Add histogram(s) for byte counts of unsupported schemes, e.g.,
+ // ws and wss.
+ if (!request->url().SchemeIsHTTPOrHTTPS())
return;
- }
DataReductionProxyTypeInfo data_reduction_proxy_type_info;
if (data_reduction_proxy_params_->WasDataReductionProxyUsed(
sclittle 2014/12/30 22:10:41 Putting NOT_BYPASSED above PROXY_OVERRIDDEN like y
bengr 2014/12/30 23:22:30 Done.
@@ -241,16 +242,24 @@ void DataReductionProxyUsageStats::RecordBypassedBytesHistograms(
return;
}
- if (data_reduction_proxy_enabled.GetValue() &&
- request->url().SchemeIs(url::kHttpsScheme)) {
+ if (request->url().SchemeIs(url::kHttpsScheme)) {
RecordBypassedBytes(last_bypass_type_,
DataReductionProxyUsageStats::SSL,
content_length);
return;
}
- if (data_reduction_proxy_enabled.GetValue() &&
- data_reduction_proxy_params_->IsBypassedByDataReductionProxyLocalRules(
+ // Now that the data reduction proxy is a best effort proxy, if the effective
+ // proxy configuration resolves to anything other than direct:// for a URL,
+ // the data reduction proxy will not be used.
+ if (!request->proxy_server().IsEmpty()) {
sclittle 2014/12/30 22:10:41 Nit: Maybe add a DCHECK or something here to asser
bengr 2014/12/30 23:22:30 Done.
+ RecordBypassedBytes(last_bypass_type_,
+ DataReductionProxyUsageStats::PROXY_OVERRIDDEN,
sclittle 2014/12/30 22:10:41 Moving PROXY_OVERRIDDEN down below SSL here slight
bengr 2014/12/30 23:22:30 This was intentional. I want to know how much traf
sclittle 2014/12/30 23:54:26 OK
+ content_length);
+ return;
+ }
+
+ if (data_reduction_proxy_params_->IsBypassedByDataReductionProxyLocalRules(
*request, data_reduction_proxy_config)) {
RecordBypassedBytes(last_bypass_type_,
DataReductionProxyUsageStats::LOCAL_BYPASS_RULES,
@@ -292,8 +301,7 @@ void DataReductionProxyUsageStats::RecordBypassedBytesHistograms(
return;
}
- if (data_reduction_proxy_enabled.GetValue() &&
- data_reduction_proxy_params_->AreDataReductionProxiesBypassed(*request,
+ if (data_reduction_proxy_params_->AreDataReductionProxiesBypassed(*request,
NULL)) {
RecordBypassedBytes(last_bypass_type_,
DataReductionProxyUsageStats::NETWORK_ERROR,
@@ -369,9 +377,9 @@ void DataReductionProxyUsageStats::RecordBypassedBytes(
"DataReductionProxy.BypassedBytes.LocalBypassRules",
content_length);
break;
- case DataReductionProxyUsageStats::MANAGED_PROXY_CONFIG:
+ case DataReductionProxyUsageStats::PROXY_OVERRIDDEN:
UMA_HISTOGRAM_COUNTS(
- "DataReductionProxy.BypassedBytes.ManagedProxyConfig",
+ "DataReductionProxy.BypassedBytes.ProxyOverridden",
content_length);
break;
case DataReductionProxyUsageStats::AUDIO_VIDEO:

Powered by Google App Engine
This is Rietveld 408576698