| 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 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 | 1167 |
| 1168 // We don't have new proxy settings to try, try to fallback to the next proxy | 1168 // We don't have new proxy settings to try, try to fallback to the next proxy |
| 1169 // in the list. | 1169 // in the list. |
| 1170 bool did_fallback = result->Fallback(net_log); | 1170 bool did_fallback = result->Fallback(net_log); |
| 1171 | 1171 |
| 1172 // Return synchronous failure if there is nothing left to fall-back to. | 1172 // Return synchronous failure if there is nothing left to fall-back to. |
| 1173 // TODO(eroman): This is a yucky API, clean it up. | 1173 // TODO(eroman): This is a yucky API, clean it up. |
| 1174 return did_fallback ? OK : ERR_FAILED; | 1174 return did_fallback ? OK : ERR_FAILED; |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 bool ProxyService::Fallback(ProxyInfo* result, const BoundNetLog& net_log) { |
| 1178 return result->Fallback(proxy_retry_info_, net_log); |
| 1179 } |
| 1180 |
| 1177 void ProxyService::ReportSuccess(const ProxyInfo& result) { | 1181 void ProxyService::ReportSuccess(const ProxyInfo& result) { |
| 1178 DCHECK(CalledOnValidThread()); | 1182 DCHECK(CalledOnValidThread()); |
| 1179 | 1183 |
| 1180 const ProxyRetryInfoMap& new_retry_info = result.proxy_retry_info(); | 1184 const ProxyRetryInfoMap& new_retry_info = result.proxy_retry_info(); |
| 1181 if (new_retry_info.empty()) | 1185 if (new_retry_info.empty()) |
| 1182 return; | 1186 return; |
| 1183 | 1187 |
| 1184 for (ProxyRetryInfoMap::const_iterator iter = new_retry_info.begin(); | 1188 for (ProxyRetryInfoMap::const_iterator iter = new_retry_info.begin(); |
| 1185 iter != new_retry_info.end(); ++iter) { | 1189 iter != new_retry_info.end(); ++iter) { |
| 1186 ProxyRetryInfoMap::iterator existing = proxy_retry_info_.find(iter->first); | 1190 ProxyRetryInfoMap::iterator existing = proxy_retry_info_.find(iter->first); |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1552 OnCompletion(result_); | 1556 OnCompletion(result_); |
| 1553 } | 1557 } |
| 1554 } | 1558 } |
| 1555 | 1559 |
| 1556 void SyncProxyServiceHelper::OnCompletion(int rv) { | 1560 void SyncProxyServiceHelper::OnCompletion(int rv) { |
| 1557 result_ = rv; | 1561 result_ = rv; |
| 1558 event_.Signal(); | 1562 event_.Signal(); |
| 1559 } | 1563 } |
| 1560 | 1564 |
| 1561 } // namespace net | 1565 } // namespace net |
| OLD | NEW |