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

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

Issue 2845643003: Allow ProxyService to share URLRequestContext with everything else. (Closed)
Patch Set: Fix fetcher shutdown with no active request, add test, add comment Created 3 years, 7 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/dhcp_proxy_script_fetcher.cc ('k') | net/proxy/dhcp_proxy_script_fetcher_win.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_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ 5 #ifndef NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_
6 #define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ 6 #define NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 26 matching lines...) Expand all
37 // Creates a DhcpProxyScriptFetcherWin that issues requests through 37 // Creates a DhcpProxyScriptFetcherWin that issues requests through
38 // |url_request_context|. |url_request_context| must remain valid for 38 // |url_request_context|. |url_request_context| must remain valid for
39 // the lifetime of DhcpProxyScriptFetcherWin. 39 // the lifetime of DhcpProxyScriptFetcherWin.
40 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context); 40 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context);
41 ~DhcpProxyScriptFetcherWin() override; 41 ~DhcpProxyScriptFetcherWin() override;
42 42
43 // DhcpProxyScriptFetcher implementation. 43 // DhcpProxyScriptFetcher implementation.
44 int Fetch(base::string16* utf16_text, 44 int Fetch(base::string16* utf16_text,
45 const CompletionCallback& callback) override; 45 const CompletionCallback& callback) override;
46 void Cancel() override; 46 void Cancel() override;
47 void OnShutdown() override;
47 const GURL& GetPacURL() const override; 48 const GURL& GetPacURL() const override;
48 std::string GetFetcherName() const override; 49 std::string GetFetcherName() const override;
49 50
50 // Sets |adapter_names| to contain the name of each network adapter on 51 // Sets |adapter_names| to contain the name of each network adapter on
51 // this machine that has DHCP enabled and is not a loop-back adapter. Returns 52 // this machine that has DHCP enabled and is not a loop-back adapter. Returns
52 // false on error. 53 // false on error.
53 static bool GetCandidateAdapterNames(std::set<std::string>* adapter_names); 54 static bool GetCandidateAdapterNames(std::set<std::string>* adapter_names);
54 55
55 protected: 56 protected:
56 int num_pending_fetchers() const; 57 int num_pending_fetchers() const;
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 // Pointer to string we will write results to. Not valid in states 160 // Pointer to string we will write results to. Not valid in states
160 // START and DONE. 161 // START and DONE.
161 base::string16* destination_string_; 162 base::string16* destination_string_;
162 163
163 // PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE. 164 // PAC URL retrieved from DHCP, if any. Valid only in state STATE_DONE.
164 GURL pac_url_; 165 GURL pac_url_;
165 166
166 base::OneShotTimer wait_timer_; 167 base::OneShotTimer wait_timer_;
167 168
168 URLRequestContext* const url_request_context_; 169 // Set to nullptr on cancellation.
170 URLRequestContext* url_request_context_;
169 171
170 // NULL or the AdapterQuery currently in flight. 172 // NULL or the AdapterQuery currently in flight.
171 scoped_refptr<AdapterQuery> last_query_; 173 scoped_refptr<AdapterQuery> last_query_;
172 174
173 // Time |Fetch()| was last called, 0 if never. 175 // Time |Fetch()| was last called, 0 if never.
174 base::TimeTicks fetch_start_time_; 176 base::TimeTicks fetch_start_time_;
175 177
176 // Worker pool we use for all DHCP lookup tasks. 178 // Worker pool we use for all DHCP lookup tasks.
177 scoped_refptr<base::SequencedWorkerPool> worker_pool_; 179 scoped_refptr<base::SequencedWorkerPool> worker_pool_;
178 180
179 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); 181 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin);
180 }; 182 };
181 183
182 } // namespace net 184 } // namespace net
183 185
184 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ 186 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_
OLDNEW
« no previous file with comments | « net/proxy/dhcp_proxy_script_fetcher.cc ('k') | net/proxy/dhcp_proxy_script_fetcher_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698