| 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_list.h" | 5 #include "net/proxy/proxy_list.h" |
| 6 | 6 |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string_tokenizer.h" | 9 #include "base/strings/string_tokenizer.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "net/log/net_log_event_type.h" |
| 12 #include "net/proxy/proxy_server.h" | 13 #include "net/proxy/proxy_server.h" |
| 13 | 14 |
| 14 using base::TimeDelta; | 15 using base::TimeDelta; |
| 15 using base::TimeTicks; | 16 using base::TimeTicks; |
| 16 | 17 |
| 17 namespace net { | 18 namespace net { |
| 18 | 19 |
| 19 ProxyList::ProxyList() { | 20 ProxyList::ProxyList() { |
| 20 } | 21 } |
| 21 | 22 |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 std::string proxy_key = proxy_to_retry.ToURI(); | 193 std::string proxy_key = proxy_to_retry.ToURI(); |
| 193 ProxyRetryInfoMap::iterator iter = proxy_retry_info->find(proxy_key); | 194 ProxyRetryInfoMap::iterator iter = proxy_retry_info->find(proxy_key); |
| 194 if (iter == proxy_retry_info->end() || bad_until > iter->second.bad_until) { | 195 if (iter == proxy_retry_info->end() || bad_until > iter->second.bad_until) { |
| 195 ProxyRetryInfo retry_info; | 196 ProxyRetryInfo retry_info; |
| 196 retry_info.current_delay = retry_delay; | 197 retry_info.current_delay = retry_delay; |
| 197 retry_info.bad_until = bad_until; | 198 retry_info.bad_until = bad_until; |
| 198 retry_info.try_while_bad = try_while_bad; | 199 retry_info.try_while_bad = try_while_bad; |
| 199 retry_info.net_error = net_error; | 200 retry_info.net_error = net_error; |
| 200 (*proxy_retry_info)[proxy_key] = retry_info; | 201 (*proxy_retry_info)[proxy_key] = retry_info; |
| 201 } | 202 } |
| 202 net_log.AddEvent(NetLog::TYPE_PROXY_LIST_FALLBACK, | 203 net_log.AddEvent(NetLogEventType::PROXY_LIST_FALLBACK, |
| 203 NetLog::StringCallback("bad_proxy", &proxy_key)); | 204 NetLog::StringCallback("bad_proxy", &proxy_key)); |
| 204 } | 205 } |
| 205 | 206 |
| 206 void ProxyList::UpdateRetryInfoOnFallback( | 207 void ProxyList::UpdateRetryInfoOnFallback( |
| 207 ProxyRetryInfoMap* proxy_retry_info, | 208 ProxyRetryInfoMap* proxy_retry_info, |
| 208 base::TimeDelta retry_delay, | 209 base::TimeDelta retry_delay, |
| 209 bool reconsider, | 210 bool reconsider, |
| 210 const std::vector<ProxyServer>& additional_proxies_to_bypass, | 211 const std::vector<ProxyServer>& additional_proxies_to_bypass, |
| 211 int net_error, | 212 int net_error, |
| 212 const BoundNetLog& net_log) const { | 213 const BoundNetLog& net_log) const { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 227 // If any additional proxies to bypass are specified, add to the retry map | 228 // If any additional proxies to bypass are specified, add to the retry map |
| 228 // as well. | 229 // as well. |
| 229 for (const ProxyServer& additional_proxy : additional_proxies_to_bypass) { | 230 for (const ProxyServer& additional_proxy : additional_proxies_to_bypass) { |
| 230 AddProxyToRetryList(proxy_retry_info, retry_delay, reconsider, | 231 AddProxyToRetryList(proxy_retry_info, retry_delay, reconsider, |
| 231 additional_proxy, net_error, net_log); | 232 additional_proxy, net_error, net_log); |
| 232 } | 233 } |
| 233 } | 234 } |
| 234 } | 235 } |
| 235 | 236 |
| 236 } // namespace net | 237 } // namespace net |
| OLD | NEW |