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 #ifndef NET_PROXY_PROXY_LIST_H_ | 5 #ifndef NET_PROXY_PROXY_LIST_H_ |
6 #define NET_PROXY_PROXY_LIST_H_ | 6 #define NET_PROXY_PROXY_LIST_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 std::unique_ptr<base::ListValue> ToValue() const; | 85 std::unique_ptr<base::ListValue> ToValue() const; |
86 | 86 |
87 // Marks the current proxy server as bad and deletes it from the list. The | 87 // Marks the current proxy server as bad and deletes it from the list. The |
88 // list of known bad proxies is given by |proxy_retry_info|. |net_error| | 88 // list of known bad proxies is given by |proxy_retry_info|. |net_error| |
89 // should contain the network error encountered when this proxy was tried, if | 89 // should contain the network error encountered when this proxy was tried, if |
90 // any. If this fallback is not because of a network error, then |OK| should | 90 // any. If this fallback is not because of a network error, then |OK| should |
91 // be passed in (eg. for reasons such as local policy). Returns true if there | 91 // be passed in (eg. for reasons such as local policy). Returns true if there |
92 // is another server available in the list. | 92 // is another server available in the list. |
93 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, | 93 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, |
94 int net_error, | 94 int net_error, |
95 const BoundNetLog& net_log); | 95 const NetLogWithSource& net_log); |
96 | 96 |
97 // Updates |proxy_retry_info| to indicate that the first proxy in the list | 97 // Updates |proxy_retry_info| to indicate that the first proxy in the list |
98 // is bad. This is distinct from Fallback(), above, to allow updating proxy | 98 // is bad. This is distinct from Fallback(), above, to allow updating proxy |
99 // retry information without modifying a given transction's proxy list. Will | 99 // retry information without modifying a given transction's proxy list. Will |
100 // retry after |retry_delay| if positive, and will use the default proxy retry | 100 // retry after |retry_delay| if positive, and will use the default proxy retry |
101 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| | 101 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| |
102 // is true. Additionally updates |proxy_retry_info| with | 102 // is true. Additionally updates |proxy_retry_info| with |
103 // |additional_proxies_to_bypass|. |net_error| should contain the network | 103 // |additional_proxies_to_bypass|. |net_error| should contain the network |
104 // error countered when this proxy was tried, or OK if the proxy retry info is | 104 // error countered when this proxy was tried, or OK if the proxy retry info is |
105 // being updated for a non-network related reason (e.g. local policy). | 105 // being updated for a non-network related reason (e.g. local policy). |
106 void UpdateRetryInfoOnFallback( | 106 void UpdateRetryInfoOnFallback( |
107 ProxyRetryInfoMap* proxy_retry_info, | 107 ProxyRetryInfoMap* proxy_retry_info, |
108 base::TimeDelta retry_delay, | 108 base::TimeDelta retry_delay, |
109 bool reconsider, | 109 bool reconsider, |
110 const std::vector<ProxyServer>& additional_proxies_to_bypass, | 110 const std::vector<ProxyServer>& additional_proxies_to_bypass, |
111 int net_error, | 111 int net_error, |
112 const BoundNetLog& net_log) const; | 112 const NetLogWithSource& net_log) const; |
113 | 113 |
114 private: | 114 private: |
115 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in | 115 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in |
116 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if | 116 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if |
117 // |try_while_bad| is true. |net_error| should contain the network error | 117 // |try_while_bad| is true. |net_error| should contain the network error |
118 // countered when this proxy was tried, or OK if the proxy retry info is | 118 // countered when this proxy was tried, or OK if the proxy retry info is |
119 // being updated for a non-network related reason (e.g. local policy). | 119 // being updated for a non-network related reason (e.g. local policy). |
120 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, | 120 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, |
121 base::TimeDelta retry_delay, | 121 base::TimeDelta retry_delay, |
122 bool try_while_bad, | 122 bool try_while_bad, |
123 const ProxyServer& proxy_to_retry, | 123 const ProxyServer& proxy_to_retry, |
124 int net_error, | 124 int net_error, |
125 const BoundNetLog& net_log) const; | 125 const NetLogWithSource& net_log) const; |
126 | 126 |
127 // List of proxies. | 127 // List of proxies. |
128 std::vector<ProxyServer> proxies_; | 128 std::vector<ProxyServer> proxies_; |
129 }; | 129 }; |
130 | 130 |
131 } // namespace net | 131 } // namespace net |
132 | 132 |
133 #endif // NET_PROXY_PROXY_LIST_H_ | 133 #endif // NET_PROXY_PROXY_LIST_H_ |
OLD | NEW |