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

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

Issue 2905423002: Do not attempt to use data reduction proxy when holdback is enabled (Closed)
Patch Set: Created 3 years, 7 months 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
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
index c94d5ea77bb76c0acaaf8eecfecfa6ac937152b9..a57e562e2730937253ef7df1814740487bdbaa7a 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
@@ -214,6 +214,9 @@ int64_t EstimateOriginalReceivedBytes(const net::URLRequest& request,
// Saver proxy.
void VerifyHttpRequestHeaders(bool via_chrome_proxy,
const net::HttpRequestHeaders& headers) {
+ // If holdback is enabled, then |via_chrome_proxy| should be false.
+ DCHECK(!params::IsIncludedInHoldbackFieldTrial() || !via_chrome_proxy);
+
if (via_chrome_proxy) {
DCHECK(headers.HasHeader(chrome_proxy_ect_header()));
std::string chrome_proxy_header_value;
@@ -342,16 +345,17 @@ void DataReductionProxyNetworkDelegate::OnBeforeSendHeadersInternal(
DataReductionProxyData::ClearData(request);
if (params::IsIncludedInHoldbackFieldTrial()) {
- if (!WasEligibleWithoutHoldback(*request, proxy_info, proxy_retry_info))
- return;
- // For the holdback field trial, still log UMA as if the proxy was used.
- data = DataReductionProxyData::GetDataAndCreateIfNecessary(request);
- if (data)
- data->set_used_data_reduction_proxy(true);
-
- headers->RemoveHeader(chrome_proxy_header());
- VerifyHttpRequestHeaders(false, *headers);
- return;
+ if (WasEligibleWithoutHoldback(*request, proxy_info, proxy_retry_info)) {
+ // For the holdback field trial, still log UMA as if the proxy was used.
+ data = DataReductionProxyData::GetDataAndCreateIfNecessary(request);
+ if (data)
+ data->set_used_data_reduction_proxy(true);
+ }
+ // If holdback is enabled, |proxy_info| must not contain a data reduction
+ // proxy.
+ DCHECK(proxy_info.is_empty() ||
+ !data_reduction_proxy_config_->IsDataReductionProxy(
+ proxy_info.proxy_server(), nullptr));
}
bool using_data_reduction_proxy = true;
@@ -365,6 +369,9 @@ void DataReductionProxyNetworkDelegate::OnBeforeSendHeadersInternal(
proxy_info.proxy_server(), nullptr)) {
using_data_reduction_proxy = false;
}
+ // If holdback is enabled, |using_data_reduction_proxy| must be false.
+ DCHECK(!params::IsIncludedInHoldbackFieldTrial() ||
+ !using_data_reduction_proxy);
LoFiDecider* lofi_decider = nullptr;
if (data_reduction_proxy_io_data_)
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_delegate_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698