| 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_adapter_fetcher_win.h" | 5 #include "net/proxy/dhcp_proxy_script_adapter_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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/message_loop_proxy.h" | 10 #include "base/message_loop_proxy.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 DhcpProxyScriptAdapterFetcher::DhcpProxyScriptAdapterFetcher( | 34 DhcpProxyScriptAdapterFetcher::DhcpProxyScriptAdapterFetcher( |
| 35 URLRequestContext* url_request_context) | 35 URLRequestContext* url_request_context) |
| 36 : state_(STATE_START), | 36 : state_(STATE_START), |
| 37 result_(ERR_IO_PENDING), | 37 result_(ERR_IO_PENDING), |
| 38 url_request_context_(url_request_context) { | 38 url_request_context_(url_request_context) { |
| 39 DCHECK(url_request_context_); | 39 DCHECK(url_request_context_); |
| 40 } | 40 } |
| 41 | 41 |
| 42 DhcpProxyScriptAdapterFetcher::~DhcpProxyScriptAdapterFetcher() { | 42 DhcpProxyScriptAdapterFetcher::~DhcpProxyScriptAdapterFetcher() { |
| 43 Cancel(); | 43 Cancel(); |
| 44 | |
| 45 // The WeakPtr we passed to the worker thread may be destroyed on the | |
| 46 // worker thread. This detaches any outstanding WeakPtr state from | |
| 47 // the current thread. | |
| 48 base::SupportsWeakPtr<DhcpProxyScriptAdapterFetcher>::DetachFromThread(); | |
| 49 } | 44 } |
| 50 | 45 |
| 51 void DhcpProxyScriptAdapterFetcher::Fetch( | 46 void DhcpProxyScriptAdapterFetcher::Fetch( |
| 52 const std::string& adapter_name, const CompletionCallback& callback) { | 47 const std::string& adapter_name, const CompletionCallback& callback) { |
| 53 DCHECK(CalledOnValidThread()); | 48 DCHECK(CalledOnValidThread()); |
| 54 DCHECK_EQ(state_, STATE_START); | 49 DCHECK_EQ(state_, STATE_START); |
| 55 result_ = ERR_IO_PENDING; | 50 result_ = ERR_IO_PENDING; |
| 56 pac_script_ = base::string16(); | 51 pac_script_ = base::string16(); |
| 57 state_ = STATE_WAIT_DHCP; | 52 state_ = STATE_WAIT_DHCP; |
| 58 callback_ = callback; | 53 callback_ = callback; |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 // back a buffer with embedded NULLs, something is broken anyway. | 279 // back a buffer with embedded NULLs, something is broken anyway. |
| 285 return std::string( | 280 return std::string( |
| 286 std::string(reinterpret_cast<const char *>(wpad_params.Data), | 281 std::string(reinterpret_cast<const char *>(wpad_params.Data), |
| 287 wpad_params.nBytesData).c_str()); | 282 wpad_params.nBytesData).c_str()); |
| 288 } | 283 } |
| 289 | 284 |
| 290 return ""; | 285 return ""; |
| 291 } | 286 } |
| 292 | 287 |
| 293 } // namespace net | 288 } // namespace net |
| OLD | NEW |