Chromium Code Reviews| Index: chrome/browser/net/predictor.cc |
| diff --git a/chrome/browser/net/predictor.cc b/chrome/browser/net/predictor.cc |
| index df12e02534c37b11e1f49ad8d7a988b9131cd2d1..ad12b17b0e08d3d9b577f454021458400130de08 100644 |
| --- a/chrome/browser/net/predictor.cc |
| +++ b/chrome/browser/net/predictor.cc |
| @@ -38,6 +38,7 @@ |
| #include "net/base/address_list.h" |
| #include "net/base/completion_callback.h" |
| #include "net/base/host_port_pair.h" |
| +#include "net/base/load_flags.h" |
| #include "net/base/net_errors.h" |
| #include "net/base/net_log.h" |
| #include "net/dns/host_resolver.h" |
| @@ -148,6 +149,7 @@ Predictor::Predictor(bool preconnect_enabled, bool predictor_enabled) |
| host_resolver_(NULL), |
| transport_security_state_(NULL), |
| ssl_config_service_(NULL), |
| + proxy_service_(NULL), |
| preconnect_enabled_(preconnect_enabled), |
| consecutive_omnibox_preconnect_count_(0), |
| next_trim_time_(base::TimeTicks::Now() + |
| @@ -699,6 +701,7 @@ void Predictor::FinalizeInitializationOnIOThread( |
| url_request_context_getter_->GetURLRequestContext(); |
| transport_security_state_ = context->transport_security_state(); |
| ssl_config_service_ = context->ssl_config_service(); |
| + proxy_service_ = context->proxy_service(); |
| // base::WeakPtrFactory instances need to be created and destroyed |
| // on the same thread. The predictor lives on the IO thread and will die |
| @@ -1033,6 +1036,18 @@ void Predictor::LookupFinished(LookupRequest* request, const GURL& url, |
| } |
| } |
| +bool Predictor::WouldLikelyProxyURL(const GURL& url) { |
| + if (!proxy_service_) |
| + return false; |
| + |
| + net::ProxyInfo info; |
| + net::CompletionCallback null_callback; |
| + int response_code = proxy_service_->ResolveProxy(url, net::LOAD_NORMAL, &info, |
| + null_callback, NULL, NULL, net::BoundNetLog()); |
| + |
| + return response_code == net::OK && !info.is_direct(); |
| +} |
| + |
| UrlInfo* Predictor::AppendToResolutionQueue( |
| const GURL& url, |
| UrlInfo::ResolutionMotivation motivation) { |
| @@ -1055,7 +1070,8 @@ UrlInfo* Predictor::AppendToResolutionQueue( |
| } |
| AdviseProxy(url, motivation, false /* is_preconnect */); |
| - if (proxy_advisor_ && proxy_advisor_->WouldProxyURL(url)) { |
| + if ((proxy_advisor_ && proxy_advisor_->WouldProxyURL(url)) || |
|
eroman
2014/09/23 20:50:41
What is the role of proxy_advisor? How does this d
bemasc
2014/09/24 18:34:36
proxy_advisor is poorly named, IMHO. It is only n
|
| + WouldLikelyProxyURL(url)) { |
| info->DLogResultsStats("DNS PrefetchForProxiedRequest"); |
| return NULL; |
| } |