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

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

Issue 1286373002: Refactored not to expose raw pointers on ProxyList class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « net/proxy/proxy_info.cc ('k') | net/proxy/proxy_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // "DIRECT" 71 // "DIRECT"
72 // "PROXY foopy1" 72 // "PROXY foopy1"
73 // "PROXY foopy1; SOCKS4 foopy2:1188" 73 // "PROXY foopy1; SOCKS4 foopy2:1188"
74 // Does a best-effort parse, and silently discards any errors. 74 // Does a best-effort parse, and silently discards any errors.
75 void SetFromPacString(const std::string& pac_string); 75 void SetFromPacString(const std::string& pac_string);
76 76
77 // Returns a PAC-style semicolon-separated list of valid proxy servers. 77 // Returns a PAC-style semicolon-separated list of valid proxy servers.
78 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy". 78 // For example: "PROXY xxx.xxx.xxx.xxx:xx; SOCKS yyy.yyy.yyy:yy".
79 std::string ToPacString() const; 79 std::string ToPacString() const;
80 80
81 // Returns a serialized value for the list. The caller takes ownership of it. 81 // Returns a serialized value for the list. The caller takes ownership of it.
eroman 2015/08/18 01:32:09 Remove comment about ownership since that is now i
msu.koo 2015/08/24 12:07:17 Done.
82 base::ListValue* ToValue() const; 82 scoped_ptr<base::ListValue> ToValue() const;
83 83
84 // Marks the current proxy server as bad and deletes it from the list. The 84 // Marks the current proxy server as bad and deletes it from the list. The
85 // list of known bad proxies is given by |proxy_retry_info|. |net_error| 85 // list of known bad proxies is given by |proxy_retry_info|. |net_error|
86 // should contain the network error encountered when this proxy was tried, if 86 // should contain the network error encountered when this proxy was tried, if
87 // any. If this fallback is not because of a network error, then |OK| should 87 // any. If this fallback is not because of a network error, then |OK| should
88 // be passed in (eg. for reasons such as local policy). Returns true if there 88 // be passed in (eg. for reasons such as local policy). Returns true if there
89 // is another server available in the list. 89 // is another server available in the list.
90 bool Fallback(ProxyRetryInfoMap* proxy_retry_info, 90 bool Fallback(ProxyRetryInfoMap& proxy_retry_info,
eroman 2015/08/18 01:32:10 This violates the style guide: https://google-styl
msu.koo 2015/08/24 12:07:18 I think it's better just to use raw pointers in he
91 int net_error, 91 int net_error,
92 const BoundNetLog& net_log); 92 const BoundNetLog& net_log);
93 93
94 // Updates |proxy_retry_info| to indicate that the first proxy in the list 94 // Updates |proxy_retry_info| to indicate that the first proxy in the list
95 // is bad. This is distinct from Fallback(), above, to allow updating proxy 95 // is bad. This is distinct from Fallback(), above, to allow updating proxy
96 // retry information without modifying a given transction's proxy list. Will 96 // retry information without modifying a given transction's proxy list. Will
97 // retry after |retry_delay| if positive, and will use the default proxy retry 97 // retry after |retry_delay| if positive, and will use the default proxy retry
98 // duration otherwise. It may reconsider the proxy beforehand if |reconsider| 98 // duration otherwise. It may reconsider the proxy beforehand if |reconsider|
99 // is true. Additionally updates |proxy_retry_info| with 99 // is true. Additionally updates |proxy_retry_info| with
100 // |additional_proxies_to_bypass|. |net_error| should contain the network 100 // |additional_proxies_to_bypass|. |net_error| should contain the network
101 // error countered when this proxy was tried, or OK if the proxy retry info is 101 // error countered when this proxy was tried, or OK if the proxy retry info is
102 // being updated for a non-network related reason (e.g. local policy). 102 // being updated for a non-network related reason (e.g. local policy).
103 void UpdateRetryInfoOnFallback( 103 void UpdateRetryInfoOnFallback(
104 ProxyRetryInfoMap* proxy_retry_info, 104 ProxyRetryInfoMap& proxy_retry_info,
105 base::TimeDelta retry_delay, 105 base::TimeDelta retry_delay,
106 bool reconsider, 106 bool reconsider,
107 const std::vector<ProxyServer>& additional_proxies_to_bypass, 107 const std::vector<ProxyServer>& additional_proxies_to_bypass,
108 int net_error, 108 int net_error,
109 const BoundNetLog& net_log) const; 109 const BoundNetLog& net_log) const;
110 110
111 private: 111 private:
112 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in 112 // Updates |proxy_retry_info| to indicate that the |proxy_to_retry| in
113 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if 113 // |proxies_| is bad for |retry_delay|, but may be reconsidered earlier if
114 // |try_while_bad| is true. |net_error| should contain the network error 114 // |try_while_bad| is true. |net_error| should contain the network error
115 // countered when this proxy was tried, or OK if the proxy retry info is 115 // countered when this proxy was tried, or OK if the proxy retry info is
116 // being updated for a non-network related reason (e.g. local policy). 116 // being updated for a non-network related reason (e.g. local policy).
117 void AddProxyToRetryList(ProxyRetryInfoMap* proxy_retry_info, 117 void AddProxyToRetryList(ProxyRetryInfoMap& proxy_retry_info,
eroman 2015/08/18 01:32:09 Same comment as earlier
msu.koo 2015/08/24 12:07:17 ditto
118 base::TimeDelta retry_delay, 118 base::TimeDelta retry_delay,
119 bool try_while_bad, 119 bool try_while_bad,
120 const ProxyServer& proxy_to_retry, 120 const ProxyServer& proxy_to_retry,
121 int net_error, 121 int net_error,
122 const BoundNetLog& net_log) const; 122 const BoundNetLog& net_log) const;
123 123
124 // List of proxies. 124 // List of proxies.
125 std::vector<ProxyServer> proxies_; 125 std::vector<ProxyServer> proxies_;
126 }; 126 };
127 127
128 } // namespace net 128 } // namespace net
129 129
130 #endif // NET_PROXY_PROXY_LIST_H_ 130 #endif // NET_PROXY_PROXY_LIST_H_
OLDNEW
« no previous file with comments | « net/proxy/proxy_info.cc ('k') | net/proxy/proxy_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698