Chromium Code Reviews| Index: net/proxy/proxy_service.cc |
| diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc |
| index c5cd6ac3354c6630f64426dd938a29d1a00e7ee3..25770d98b941b85f3ce41da875a908a97a6b15f4 100644 |
| --- a/net/proxy/proxy_service.cc |
| +++ b/net/proxy/proxy_service.cc |
| @@ -771,7 +771,7 @@ class ProxyService::PacRequest |
| } |
| void StartAndCompleteCheckingForSynchronous() { |
| - int rv = service_->TryToCompleteSynchronously(url_, results_); |
| + int rv = service_->TryToCompleteSynchronously(url_, 0, results_); |
| if (rv == ERR_IO_PENDING) |
| rv = Start(); |
| if (rv != ERR_IO_PENDING) |
| @@ -877,10 +877,12 @@ class ProxyService::PacRequest |
| ProxyService::ProxyService(ProxyConfigService* config_service, |
| ProxyResolver* resolver, |
| + NetworkDelegate* network_delegate, |
| NetLog* net_log) |
| : resolver_(resolver), |
| next_config_id_(1), |
| - current_state_(STATE_NONE) , |
| + current_state_(STATE_NONE), |
| + network_delegate_(network_delegate), |
| net_log_(net_log), |
| stall_proxy_auto_config_delay_(TimeDelta::FromMilliseconds( |
| kDelayAfterNetworkChangesMs)), |
| @@ -909,7 +911,7 @@ ProxyService* ProxyService::CreateUsingSystemProxyResolver( |
| ProxyResolver* proxy_resolver = new MultiThreadedProxyResolver( |
| new ProxyResolverFactoryForSystem(), num_pac_threads); |
| - return new ProxyService(proxy_config_service, proxy_resolver, net_log); |
| + return new ProxyService(proxy_config_service, proxy_resolver, NULL, net_log); |
| } |
| // static |
| @@ -918,6 +920,7 @@ ProxyService* ProxyService::CreateWithoutProxyResolver( |
| NetLog* net_log) { |
| return new ProxyService(proxy_config_service, |
| new ProxyResolverNull(), |
| + NULL, |
| net_log); |
| } |
| @@ -944,7 +947,7 @@ ProxyService* ProxyService::CreateDirect() { |
| ProxyService* ProxyService::CreateDirectWithNetLog(NetLog* net_log) { |
| // Use direct connections. |
| return new ProxyService(new ProxyConfigServiceDirect, new ProxyResolverNull, |
| - net_log); |
| + NULL, net_log); |
| } |
| // static |
| @@ -961,10 +964,11 @@ ProxyService* ProxyService::CreateFixedFromPacResult( |
| return new ProxyService(proxy_config_service.release(), |
| proxy_resolver.release(), |
| - NULL); |
| + NULL, NULL); |
| } |
| int ProxyService::ResolveProxy(const GURL& raw_url, |
| + int load_flags, |
| ProxyInfo* result, |
| const net::CompletionCallback& callback, |
| PacRequest** pac_request, |
| @@ -989,10 +993,11 @@ int ProxyService::ResolveProxy(const GURL& raw_url, |
| // Check if the request can be completed right away. (This is the case when |
| // using a direct connection for example). |
| - int rv = TryToCompleteSynchronously(url, result); |
| + int rv = TryToCompleteSynchronously(url, load_flags, result); |
| if (rv != ERR_IO_PENDING) |
| return DidFinishResolvingProxy(result, rv, net_log); |
| + // TODO(rcs): add load_flags to PacRequest. |
|
mmenke
2014/06/27 18:59:35
Flywheel requests always go through a PAC currentl
rcs
2014/06/28 03:53:38
I ran this (a few days) without adding load_flags
rcs
2014/06/28 04:01:04
*a few days ago
rcs
2014/06/30 19:46:31
I verified that data compression proxy requests do
|
| scoped_refptr<PacRequest> req( |
| new PacRequest(this, url, result, callback, net_log)); |
| @@ -1017,6 +1022,7 @@ int ProxyService::ResolveProxy(const GURL& raw_url, |
| } |
| int ProxyService::TryToCompleteSynchronously(const GURL& url, |
| + int load_flags, |
| ProxyInfo* result) { |
| DCHECK_NE(STATE_NONE, current_state_); |
| @@ -1037,6 +1043,13 @@ int ProxyService::TryToCompleteSynchronously(const GURL& url, |
| config_.proxy_rules().Apply(url, result); |
| result->config_source_ = config_.source(); |
| result->config_id_ = config_.id(); |
| + |
| + // Allow the network delegate to interpose on the resolution decision, |
| + // possibly modifying the ProxyInfo. |
| + if (network_delegate_) { |
| + network_delegate_->NotifyResolveProxy(url, load_flags, result); |
| + } |
| + |
| return OK; |
| } |
| @@ -1183,7 +1196,7 @@ int ProxyService::ReconsiderProxyAfterError(const GURL& url, |
| // If we have a new config or the config was never tried, we delete the |
| // list of bad proxies and we try again. |
| proxy_retry_info_.clear(); |
| - return ResolveProxy(url, result, callback, pac_request, net_log); |
| + return ResolveProxy(url, 0, result, callback, pac_request, net_log); |
| } |
| #if defined(SPDY_PROXY_AUTH_ORIGIN) |
| @@ -1623,7 +1636,7 @@ SyncProxyServiceHelper::~SyncProxyServiceHelper() {} |
| void SyncProxyServiceHelper::StartAsyncResolve(const GURL& url, |
| const BoundNetLog& net_log) { |
| result_ = proxy_service_->ResolveProxy( |
| - url, &proxy_info_, callback_, NULL, net_log); |
| + url, 0, &proxy_info_, callback_, NULL, net_log); |
| if (result_ != net::ERR_IO_PENDING) { |
| OnCompletion(result_); |
| } |