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

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

Issue 2334623003: Store net::ProxyServer in HttpResponseInfo object (Closed)
Patch Set: Rebased Created 4 years, 2 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
Index: components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc
index 6bf3aa2d2315179f767406756c5f25d8e7162de6..c21542dbd7894ac2b5ef475c5d7c564150ef5e22 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc
@@ -344,18 +344,21 @@ bool DataReductionProxyConfig::WasDataReductionProxyUsed(
}
bool DataReductionProxyConfig::IsDataReductionProxy(
- const net::HostPortPair& host_port_pair,
+ const net::ProxyServer& proxy_server,
DataReductionProxyTypeInfo* proxy_info) const {
DCHECK(thread_checker_.CalledOnValidThread());
+ if (!proxy_server.is_valid() || proxy_server.is_direct())
+ return false;
+
const std::vector<net::ProxyServer>& proxy_list =
config_values_->proxies_for_http();
- auto proxy_it =
- std::find_if(proxy_list.begin(), proxy_list.end(),
- [&host_port_pair](const net::ProxyServer& proxy) {
- return proxy.is_valid() &&
- proxy.host_port_pair().Equals(host_port_pair);
- });
+ auto proxy_it = std::find_if(
eroman 2016/10/05 01:45:12 Can you just use std::find() now? ProxyServer has
tbansal1 2016/10/06 14:35:09 Done.
+ proxy_list.begin(), proxy_list.end(),
+ [&proxy_server](const net::ProxyServer& proxy) {
+ return proxy.is_valid() &&
+ proxy.host_port_pair().Equals(proxy_server.host_port_pair());
+ });
if (proxy_it != proxy_list.end()) {
if (proxy_info) {
@@ -382,7 +385,7 @@ bool DataReductionProxyConfig::IsBypassedByDataReductionProxyLocalRules(
return true;
if (result.proxy_server().is_direct())
return true;
- return !IsDataReductionProxy(result.proxy_server().host_port_pair(), NULL);
+ return !IsDataReductionProxy(result.proxy_server(), NULL);
}
bool DataReductionProxyConfig::AreDataReductionProxiesBypassed(
@@ -427,7 +430,7 @@ bool DataReductionProxyConfig::AreProxiesBypassed(
continue;
base::TimeDelta delay;
- if (IsDataReductionProxy(proxy.host_port_pair(), NULL)) {
+ if (IsDataReductionProxy(proxy, NULL)) {
if (!IsProxyBypassed(retry_map, proxy, &delay))
return false;
if (delay < min_delay)
@@ -594,7 +597,7 @@ bool DataReductionProxyConfig::ContainsDataReductionProxy(
proxy_rules.MapUrlSchemeToProxyList("http");
if (http_proxy_list && !http_proxy_list->IsEmpty() &&
// Sufficient to check only the first proxy.
- IsDataReductionProxy(http_proxy_list->Get().host_port_pair(), NULL)) {
+ IsDataReductionProxy(http_proxy_list->Get(), NULL)) {
return true;
}

Powered by Google App Engine
This is Rietveld 408576698