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

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

Issue 23181010: Fast-fail WPAD detection. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add unit tests Created 7 years, 3 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 | « no previous file | net/proxy/proxy_script_decider.cc » ('j') | net/proxy/proxy_script_decider.cc » ('J')
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_SCRIPT_DECIDER_H_ 5 #ifndef NET_PROXY_PROXY_SCRIPT_DECIDER_H_
6 #define NET_PROXY_PROXY_SCRIPT_DECIDER_H_ 6 #define NET_PROXY_PROXY_SCRIPT_DECIDER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "base/timer/timer.h" 14 #include "base/timer/timer.h"
15 #include "net/base/address_list.h"
15 #include "net/base/completion_callback.h" 16 #include "net/base/completion_callback.h"
16 #include "net/base/net_export.h" 17 #include "net/base/net_export.h"
17 #include "net/base/net_log.h" 18 #include "net/base/net_log.h"
19 #include "net/dns/host_resolver.h"
20 #include "net/dns/single_request_host_resolver.h"
18 #include "net/proxy/proxy_config.h" 21 #include "net/proxy/proxy_config.h"
19 #include "net/proxy/proxy_resolver.h" 22 #include "net/proxy/proxy_resolver.h"
20 #include "url/gurl.h" 23 #include "url/gurl.h"
21 24
22 namespace net { 25 namespace net {
23 26
24 class DhcpProxyScriptFetcher; 27 class DhcpProxyScriptFetcher;
25 class NetLogParameter; 28 class NetLogParameter;
26 class ProxyResolver; 29 class ProxyResolver;
27 class ProxyScriptFetcher; 30 class ProxyScriptFetcher;
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 Type type; 101 Type type;
99 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|. 102 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|.
100 }; 103 };
101 104
102 typedef std::vector<PacSource> PacSourceList; 105 typedef std::vector<PacSource> PacSourceList;
103 106
104 enum State { 107 enum State {
105 STATE_NONE, 108 STATE_NONE,
106 STATE_WAIT, 109 STATE_WAIT,
107 STATE_WAIT_COMPLETE, 110 STATE_WAIT_COMPLETE,
111 STATE_QUICK_CHECK,
112 STATE_QUICK_CHECK_COMPLETE,
108 STATE_FETCH_PAC_SCRIPT, 113 STATE_FETCH_PAC_SCRIPT,
109 STATE_FETCH_PAC_SCRIPT_COMPLETE, 114 STATE_FETCH_PAC_SCRIPT_COMPLETE,
110 STATE_VERIFY_PAC_SCRIPT, 115 STATE_VERIFY_PAC_SCRIPT,
111 STATE_VERIFY_PAC_SCRIPT_COMPLETE, 116 STATE_VERIFY_PAC_SCRIPT_COMPLETE,
112 }; 117 };
113 118
114 // Returns ordered list of PAC urls to try for |config|. 119 // Returns ordered list of PAC urls to try for |config|.
115 PacSourceList BuildPacSourcesFallbackList(const ProxyConfig& config) const; 120 PacSourceList BuildPacSourcesFallbackList(const ProxyConfig& config) const;
116 121
117 void OnIOCompletion(int result); 122 void OnIOCompletion(int result);
118 int DoLoop(int result); 123 int DoLoop(int result);
119 void DoCallback(int result); 124 void DoCallback(int result);
120 125
121 int DoWait(); 126 int DoWait();
122 int DoWaitComplete(int result); 127 int DoWaitComplete(int result);
123 128
129 int DoQuickCheck();
130 int DoQuickCheckComplete(int result);
131
124 int DoFetchPacScript(); 132 int DoFetchPacScript();
125 int DoFetchPacScriptComplete(int result); 133 int DoFetchPacScriptComplete(int result);
126 134
127 int DoVerifyPacScript(); 135 int DoVerifyPacScript();
128 int DoVerifyPacScriptComplete(int result); 136 int DoVerifyPacScriptComplete(int result);
129 137
130 // Tries restarting using the next fallback PAC URL: 138 // Tries restarting using the next fallback PAC URL:
131 // |pac_sources_[++current_pac_source_index]|. 139 // |pac_sources_[++current_pac_source_index]|.
132 // Returns OK and rewinds the state machine when there 140 // Returns OK and rewinds the state machine when there
133 // is something to try, otherwise returns |error|. 141 // is something to try, otherwise returns |error|.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 176
169 bool fetch_pac_bytes_; 177 bool fetch_pac_bytes_;
170 178
171 base::TimeDelta wait_delay_; 179 base::TimeDelta wait_delay_;
172 base::OneShotTimer<ProxyScriptDecider> wait_timer_; 180 base::OneShotTimer<ProxyScriptDecider> wait_timer_;
173 181
174 // Results. 182 // Results.
175 ProxyConfig effective_config_; 183 ProxyConfig effective_config_;
176 scoped_refptr<ProxyResolverScriptData> script_data_; 184 scoped_refptr<ProxyResolverScriptData> script_data_;
177 185
186 AddressList wpad_addresses_;
187 base::OneShotTimer<ProxyScriptDecider> quick_check_timer_;
188 scoped_ptr<SingleRequestHostResolver> host_resolver_;
189 base::Time quick_check_start_time_;
178 190
179 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider); 191 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider);
180 }; 192 };
181 193
182 } // namespace net 194 } // namespace net
183 195
184 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_ 196 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_
OLDNEW
« no previous file with comments | « no previous file | net/proxy/proxy_script_decider.cc » ('j') | net/proxy/proxy_script_decider.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698