OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 bool did_fallback = result->Fallback(net_error, net_log); | 1287 bool did_fallback = result->Fallback(net_error, net_log); |
1288 | 1288 |
1289 // Return synchronous failure if there is nothing left to fall-back to. | 1289 // Return synchronous failure if there is nothing left to fall-back to. |
1290 // TODO(eroman): This is a yucky API, clean it up. | 1290 // TODO(eroman): This is a yucky API, clean it up. |
1291 return did_fallback ? OK : ERR_FAILED; | 1291 return did_fallback ? OK : ERR_FAILED; |
1292 } | 1292 } |
1293 | 1293 |
1294 bool ProxyService::MarkProxiesAsBadUntil( | 1294 bool ProxyService::MarkProxiesAsBadUntil( |
1295 const ProxyInfo& result, | 1295 const ProxyInfo& result, |
1296 base::TimeDelta retry_delay, | 1296 base::TimeDelta retry_delay, |
1297 const ProxyServer& another_bad_proxy, | 1297 const std::vector<ProxyServer>& additional_bad_proxies, |
1298 const BoundNetLog& net_log) { | 1298 const BoundNetLog& net_log) { |
1299 result.proxy_list_.UpdateRetryInfoOnFallback(&proxy_retry_info_, | 1299 result.proxy_list_.UpdateRetryInfoOnFallback(&proxy_retry_info_, retry_delay, |
1300 retry_delay, | 1300 false, additional_bad_proxies, |
1301 false, | 1301 OK, net_log); |
1302 another_bad_proxy, | 1302 return result.proxy_list_.size() > (additional_bad_proxies.size() + 1); |
1303 OK, | |
1304 net_log); | |
1305 if (another_bad_proxy.is_valid()) | |
1306 return result.proxy_list_.size() > 2; | |
1307 else | |
1308 return result.proxy_list_.size() > 1; | |
1309 } | 1303 } |
1310 | 1304 |
1311 void ProxyService::ReportSuccess(const ProxyInfo& result, | 1305 void ProxyService::ReportSuccess(const ProxyInfo& result, |
1312 NetworkDelegate* network_delegate) { | 1306 NetworkDelegate* network_delegate) { |
1313 DCHECK(CalledOnValidThread()); | 1307 DCHECK(CalledOnValidThread()); |
1314 | 1308 |
1315 const ProxyRetryInfoMap& new_retry_info = result.proxy_retry_info(); | 1309 const ProxyRetryInfoMap& new_retry_info = result.proxy_retry_info(); |
1316 if (new_retry_info.empty()) | 1310 if (new_retry_info.empty()) |
1317 return; | 1311 return; |
1318 | 1312 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1631 State previous_state = ResetProxyConfig(false); | 1625 State previous_state = ResetProxyConfig(false); |
1632 if (previous_state != STATE_NONE) | 1626 if (previous_state != STATE_NONE) |
1633 ApplyProxyConfigIfAvailable(); | 1627 ApplyProxyConfigIfAvailable(); |
1634 } | 1628 } |
1635 | 1629 |
1636 void ProxyService::OnDNSChanged() { | 1630 void ProxyService::OnDNSChanged() { |
1637 OnIPAddressChanged(); | 1631 OnIPAddressChanged(); |
1638 } | 1632 } |
1639 | 1633 |
1640 } // namespace net | 1634 } // namespace net |
OLD | NEW |