OLD | NEW |
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 #include "net/proxy/dhcp_proxy_script_fetcher_win.h" | 5 #include "net/proxy/dhcp_proxy_script_fetcher_win.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/perftimer.h" | 10 #include "base/perftimer.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 : state_(STATE_START), | 40 : state_(STATE_START), |
41 num_pending_fetchers_(0), | 41 num_pending_fetchers_(0), |
42 destination_string_(NULL), | 42 destination_string_(NULL), |
43 url_request_context_(url_request_context) { | 43 url_request_context_(url_request_context) { |
44 DCHECK(url_request_context_); | 44 DCHECK(url_request_context_); |
45 } | 45 } |
46 | 46 |
47 DhcpProxyScriptFetcherWin::~DhcpProxyScriptFetcherWin() { | 47 DhcpProxyScriptFetcherWin::~DhcpProxyScriptFetcherWin() { |
48 // Count as user-initiated if we are not yet in STATE_DONE. | 48 // Count as user-initiated if we are not yet in STATE_DONE. |
49 Cancel(); | 49 Cancel(); |
50 | |
51 // The WeakPtr we passed to the worker thread may be destroyed on the | |
52 // worker thread. This detaches any outstanding WeakPtr state from | |
53 // the current thread. | |
54 base::SupportsWeakPtr<DhcpProxyScriptFetcherWin>::DetachFromThread(); | |
55 } | 50 } |
56 | 51 |
57 int DhcpProxyScriptFetcherWin::Fetch(base::string16* utf16_text, | 52 int DhcpProxyScriptFetcherWin::Fetch(base::string16* utf16_text, |
58 const CompletionCallback& callback) { | 53 const CompletionCallback& callback) { |
59 DCHECK(CalledOnValidThread()); | 54 DCHECK(CalledOnValidThread()); |
60 if (state_ != STATE_START && state_ != STATE_DONE) { | 55 if (state_ != STATE_START && state_ != STATE_DONE) { |
61 NOTREACHED(); | 56 NOTREACHED(); |
62 return ERR_UNEXPECTED; | 57 return ERR_UNEXPECTED; |
63 } | 58 } |
64 | 59 |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 DhcpProxyScriptFetcherWin::AdapterQuery::adapter_names() const { | 361 DhcpProxyScriptFetcherWin::AdapterQuery::adapter_names() const { |
367 return adapter_names_; | 362 return adapter_names_; |
368 } | 363 } |
369 | 364 |
370 bool DhcpProxyScriptFetcherWin::AdapterQuery::ImplGetCandidateAdapterNames( | 365 bool DhcpProxyScriptFetcherWin::AdapterQuery::ImplGetCandidateAdapterNames( |
371 std::set<std::string>* adapter_names) { | 366 std::set<std::string>* adapter_names) { |
372 return DhcpProxyScriptFetcherWin::GetCandidateAdapterNames(adapter_names); | 367 return DhcpProxyScriptFetcherWin::GetCandidateAdapterNames(adapter_names); |
373 } | 368 } |
374 | 369 |
375 } // namespace net | 370 } // namespace net |
OLD | NEW |