Chromium Code Reviews| Index: components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc |
| diff --git a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc |
| index 7143f7c209f51362a20bf16032c80bfe5367839b..90e8357bd0daa6eaa9dbbb8f795ea5732387c5d7 100644 |
| --- a/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc |
| +++ b/components/data_reduction_proxy/browser/data_reduction_proxy_metrics.cc |
| @@ -290,56 +290,6 @@ class DailyDataSavingUpdate { |
| DailyContentLengthUpdate received_; |
| }; |
| -// Returns true if the request is bypassed by all configured data reduction |
| -// proxies. It returns the bypass delay in delay_seconds (if not NULL). If |
| -// the request is bypassed by more than one proxy, delay_seconds returns |
| -// shortest delay. |
| -bool IsBypassRequest(const net::URLRequest* request, int64* delay_seconds) { |
| - // TODO(bengr): Add support for other data reduction proxy configurations. |
| -#if defined(SPDY_PROXY_AUTH_ORIGIN) |
| - DataReductionProxyParams params( |
| - DataReductionProxyParams::kAllowed | |
| - DataReductionProxyParams::kFallbackAllowed | |
| - DataReductionProxyParams::kPromoAllowed); |
| - DataReductionProxyParams::DataReductionProxyList proxies = |
| - params.GetAllowedProxies(); |
| - if (proxies.size() == 0) |
| - return false; |
| - |
| - if (request == NULL || request->context() == NULL || |
| - request->context()->proxy_service() == NULL) { |
| - return false; |
| - } |
| - |
| - const net::ProxyRetryInfoMap& retry_map = |
| - request->context()->proxy_service()->proxy_retry_info(); |
| - if (retry_map.size() == 0) |
| - return false; |
| - |
| - int64 shortest_delay = 0; |
| - // The request is bypassed if all configured proxies are in the retry map. |
| - for (size_t i = 0; i < proxies.size(); ++i) { |
| - std::string proxy = net::HostPortPair::FromURL(proxies[i]).ToString(); |
| - // The retry list has the scheme prefix for https but not for http. |
| - if (proxies[i].SchemeIs("https")) |
| - proxy = std::string("https://") + proxy; |
| - |
| - net::ProxyRetryInfoMap::const_iterator found = retry_map.find(proxy); |
| - if (found == retry_map.end()) |
| - return false; |
| - if (shortest_delay == 0 || |
| - shortest_delay > found->second.current_delay.InSeconds()) { |
| - shortest_delay = found->second.current_delay.InSeconds(); |
| - } |
| - } |
| - if (delay_seconds != NULL) |
| - *delay_seconds = shortest_delay; |
| - return true; |
| -#else |
| - return false; |
| -#endif |
| -} |
| - |
| } // namespace |
| DataReductionProxyRequestType GetDataReductionProxyRequestType( |
| @@ -350,9 +300,14 @@ DataReductionProxyRequestType GetDataReductionProxyRequestType( |
| NOTREACHED(); |
| return UNKNOWN_TYPE; |
| } |
| - int64 bypass_delay = 0; |
| - if (IsBypassRequest(request, &bypass_delay)) { |
| - return (bypass_delay > kLongBypassDelayInSeconds) ? |
| + DataReductionProxyParams params( |
| + DataReductionProxyParams::kAllowed | |
| + DataReductionProxyParams::kFallbackAllowed | |
| + DataReductionProxyParams::kPromoAllowed); |
| + base::TimeDelta bypass_delay; |
| + if (params.AreDataReductionProxiesBypassed(*request, &bypass_delay)) { |
| + return (bypass_delay > |
| + base::TimeDelta::FromSeconds(kLongBypassDelayInSeconds)) ? |
|
bengr
2014/07/22 16:59:44
I don't think the ternary buys anything. Rewrite a
megjablon
2014/07/22 18:40:45
Done.
|
| LONG_BYPASS : SHORT_BYPASS; |
| } |
| if (request->response_info().headers && |