Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: net/proxy/proxy_list.h

Issue 473513002: Keep track of network error in ProxyRetryInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge to head Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 // Returns a PAC-style semicolon-separated list of valid proxy servers. 74 // Returns a PAC-style semicolon-separated list of valid proxy servers.
75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". 75 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy".
76 std::string ToPacString() const; 76 std::string ToPacString() const;
77 77
78 // Returns a serialized value for the list. The caller takes ownership of it. 78 // Returns a serialized value for the list. The caller takes ownership of it.
79 base::ListValue* ToValue() const; 79 base::ListValue* ToValue() const;
80 80
81 // Marks the current proxy server as bad and deletes it from the list. The 81 // Marks the current proxy server as bad and deletes it from the list. The
82 // list of known bad proxies is given by proxy_retry_info. Returns true if 82 // list of known bad proxies is given by proxy_retry_info. Returns true if
83 // there is another server available in the list. 83 // there is another server available in the list.
Ryan Sleevi 2014/08/14 21:14:39 Add a param = update comments
Not at Google. Contact bengr 2014/08/14 23:45:22 Done. Took me a little while to figure out what yo
84 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, 84 bool Fallback(ProxyRetryInfoMap* proxy_retry_info,
85 const int net_error,
85 const BoundNetLog& net_log); 86 const BoundNetLog& net_log);
86 87
87 // Updates |proxy_retry_info| to indicate that the first proxy in the list 88 // Updates |proxy_retry_info| to indicate that the first proxy in the list
88 // is bad. This is distinct from Fallback(), above, to allow updating proxy 89 // is bad. This is distinct from Fallback(), above, to allow updating proxy
89 // retry information without modifying a given transction's proxy list. Will 90 // retry information without modifying a given transction's proxy list. Will
90 // retry after |retry_delay| if positive, and will use the default proxy retry 91 // retry after |retry_delay| if positive, and will use the default proxy retry
91 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| 92 // duration otherwise. It may reconsider the proxy beforehand if |reconsider|
92 // is true. Additionally updates |proxy_retry_info| with 93 // is true. Additionally updates |proxy_retry_info| with
93 // |another_proxy_to_bypass| if non-empty. 94 // |another_proxy_to_bypass| if non-empty.
94 void UpdateRetryInfoOnFallback( 95 void UpdateRetryInfoOnFallback(
95 ProxyRetryInfoMap* proxy_retry_info, 96 ProxyRetryInfoMap* proxy_retry_info,
96 base::TimeDelta retry_delay, 97 base::TimeDelta retry_delay,
97 bool reconsider, 98 bool reconsider,
98 const ProxyServer& another_proxy_to_bypass, 99 const ProxyServer& another_proxy_to_bypass,
100 const int net_error,
Ryan Sleevi 2014/08/14 21:14:39 Add a param = update comments also, no const
Not at Google. Contact bengr 2014/08/14 23:45:22 Done. Removed const from net_error everywhere. Ca
Ryan Sleevi 2014/08/14 23:54:03 It's an int. It's always passed by value. Making i
Not at Google. Contact bengr 2014/08/14 23:59:58 It does enforce that the value will not change wit
99 const BoundNetLog& net_log) const; 101 const BoundNetLog& net_log) const;
100 102
101 private: 103 private:
102 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in 104 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in
103 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if 105 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if
104 // |try_while_bad| is true. 106 // |try_while_bad| is true.
105 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, 107 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info,
106 base::TimeDelta retry_delay, 108 base::TimeDelta retry_delay,
107 bool try_while_bad, 109 bool try_while_bad,
108 const ProxyServer& proxy_to_retry, 110 const ProxyServer& proxy_to_retry,
111 const int net_error,
Ryan Sleevi 2014/08/14 21:14:39 add a... well, you get the idea :)
Not at Google. Contact bengr 2014/08/14 23:45:22 Done.
109 const BoundNetLog& net_log) const; 112 const BoundNetLog& net_log) const;
110 113
111 // List of proxies. 114 // List of proxies.
112 std::vector<ProxyServer> proxies_; 115 std::vector<ProxyServer> proxies_;
113 }; 116 };
114 117
115 } // namespace net 118 } // namespace net
116 119
117 #endif // NET_PROXY_PROXY_LIST_H_ 120 #endif // NET_PROXY_PROXY_LIST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698