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

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

Issue 552164: Merge 34903, 34928, 35008, 35549, 36054 to the 249s branch.... (Closed) Base URL: svn://chrome-svn/chrome/branches/249s/src/
Patch Set: Fix some other merge conflicts Created 10 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/proxy/proxy_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Modified: svn:mergeinfo
Merged /trunk/src/net/proxy/proxy_info.h:r34903,34928,35008,35549,36054
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_INFO_H_ 5 #ifndef NET_PROXY_PROXY_INFO_H_
6 #define NET_PROXY_PROXY_INFO_H_ 6 #define NET_PROXY_PROXY_INFO_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "net/proxy/proxy_config.h" 10 #include "net/proxy/proxy_config.h"
(...skipping 25 matching lines...) Expand all
36 36
37 // Set the proxy list to a single entry, |proxy_server|. 37 // Set the proxy list to a single entry, |proxy_server|.
38 void UseProxyServer(const ProxyServer& proxy_server); 38 void UseProxyServer(const ProxyServer& proxy_server);
39 39
40 // Parse from the given PAC result. 40 // Parse from the given PAC result.
41 void UsePacString(const std::string& pac_string) { 41 void UsePacString(const std::string& pac_string) {
42 proxy_list_.SetFromPacString(pac_string); 42 proxy_list_.SetFromPacString(pac_string);
43 } 43 }
44 44
45 // Returns true if this proxy info specifies a direct connection. 45 // Returns true if this proxy info specifies a direct connection.
46 bool is_direct() const { return proxy_list_.Get().is_direct(); } 46 bool is_direct() const {
47 // We don't implicitly fallback to DIRECT unless it was added to the list.
48 if (is_empty())
49 return false;
50 return proxy_list_.Get().is_direct();
51 }
47 52
48 // Returns the first valid proxy server. 53 // Returns true if this proxy info has no proxies left to try.
54 bool is_empty() const {
55 return proxy_list_.IsEmpty();
56 }
57
58 // Returns the first valid proxy server. is_empty() must be false to be able
59 // to call this function.
49 ProxyServer proxy_server() const { return proxy_list_.Get(); } 60 ProxyServer proxy_server() const { return proxy_list_.Get(); }
50 61
51 // See description in ProxyList::ToPacString(). 62 // See description in ProxyList::ToPacString().
52 std::string ToPacString(); 63 std::string ToPacString();
53 64
54 // Marks the current proxy as bad. Returns true if there is another proxy 65 // Marks the current proxy as bad. Returns true if there is another proxy
55 // available to try in proxy list_. 66 // available to try in proxy list_.
56 bool Fallback(ProxyRetryInfoMap* proxy_retry_info) { 67 bool Fallback(ProxyRetryInfoMap* proxy_retry_info) {
57 return proxy_list_.Fallback(proxy_retry_info); 68 return proxy_list_.Fallback(proxy_retry_info);
58 } 69 }
59 70
60 // Remove all proxies known to be bad from the proxy list. 71 // De-prioritizes the proxies that we have cached as not working, by moving
61 void RemoveBadProxies(const ProxyRetryInfoMap& proxy_retry_info) { 72 // them to the end of the proxy list.
62 proxy_list_.RemoveBadProxies(proxy_retry_info); 73 void DeprioritizeBadProxies(const ProxyRetryInfoMap& proxy_retry_info) {
74 proxy_list_.DeprioritizeBadProxies(proxy_retry_info);
63 } 75 }
64 76
65 // Delete any entry which doesn't have one of the specified proxy schemes. 77 // Delete any entry which doesn't have one of the specified proxy schemes.
66 void RemoveProxiesWithoutScheme(int scheme_bit_field) { 78 void RemoveProxiesWithoutScheme(int scheme_bit_field) {
67 proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field); 79 proxy_list_.RemoveProxiesWithoutScheme(scheme_bit_field);
68 } 80 }
69 81
70 private: 82 private:
71 friend class ProxyService; 83 friend class ProxyService;
72 84
73 // If proxy_list_ is set to empty, then a "direct" connection is indicated. 85 // The ordered list of proxy servers (including DIRECT attempts) remaining to
86 // try. If proxy_list_ is empty, then there is nothing left to fall back to.
74 ProxyList proxy_list_; 87 ProxyList proxy_list_;
75 88
76 // This value identifies the proxy config used to initialize this object. 89 // This value identifies the proxy config used to initialize this object.
77 ProxyConfig::ID config_id_; 90 ProxyConfig::ID config_id_;
78
79 // This flag is false when the proxy configuration was known to be bad when
80 // this proxy info was initialized. In such cases, we know that if this
81 // proxy info does not yield a connection that we might want to reconsider
82 // the proxy config given by config_id_.
83 bool config_was_tried_;
84 }; 91 };
85 92
86 } // namespace net 93 } // namespace net
87 94
88 #endif // NET_PROXY_PROXY_INFO_H_ 95 #endif // NET_PROXY_PROXY_INFO_H_
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/proxy/proxy_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698