| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SCRIPT_ADAPTER_FETCHER_WIN_H_ | 5 #ifndef NET_PROXY_DHCP_SCRIPT_ADAPTER_FETCHER_WIN_H_ |
| 6 #define NET_PROXY_DHCP_SCRIPT_ADAPTER_FETCHER_WIN_H_ | 6 #define NET_PROXY_DHCP_SCRIPT_ADAPTER_FETCHER_WIN_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 STATE_FINISH, | 104 STATE_FINISH, |
| 105 STATE_CANCEL, | 105 STATE_CANCEL, |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 State state() const; | 108 State state() const; |
| 109 | 109 |
| 110 // This inner class is used to encapsulate the worker thread, which has | 110 // This inner class is used to encapsulate the worker thread, which has |
| 111 // only a weak reference back to the main object, so that the main object | 111 // only a weak reference back to the main object, so that the main object |
| 112 // can be destroyed before the thread ends. This also keeps the main | 112 // can be destroyed before the thread ends. This also keeps the main |
| 113 // object completely thread safe and allows it to be non-refcounted. | 113 // object completely thread safe and allows it to be non-refcounted. |
| 114 // |
| 115 // TODO(joi): Replace with PostTaskAndReply once http://crbug.com/86301 |
| 116 // has been implemented. |
| 114 class NET_TEST WorkerThread | 117 class NET_TEST WorkerThread |
| 115 : public base::RefCountedThreadSafe<WorkerThread> { | 118 : public base::RefCountedThreadSafe<WorkerThread> { |
| 116 public: | 119 public: |
| 117 // Creates and initializes (but does not start) the worker thread. | 120 // Creates and initializes (but does not start) the worker thread. |
| 118 explicit WorkerThread( | 121 explicit WorkerThread( |
| 119 const base::WeakPtr<DhcpProxyScriptAdapterFetcher>& owner); | 122 const base::WeakPtr<DhcpProxyScriptAdapterFetcher>& owner); |
| 120 virtual ~WorkerThread(); | 123 virtual ~WorkerThread(); |
| 121 | 124 |
| 122 // Starts the worker thread, fetching information for |adapter_name| using | 125 // Starts the worker thread, fetching information for |adapter_name| using |
| 123 // |get_pac_from_url_func|. | 126 // |get_pac_from_url_func|. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 base::OneShotTimer<DhcpProxyScriptAdapterFetcher> wait_timer_; | 197 base::OneShotTimer<DhcpProxyScriptAdapterFetcher> wait_timer_; |
| 195 | 198 |
| 196 scoped_refptr<URLRequestContext> url_request_context_; | 199 scoped_refptr<URLRequestContext> url_request_context_; |
| 197 | 200 |
| 198 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptAdapterFetcher); | 201 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptAdapterFetcher); |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 } // namespace net | 204 } // namespace net |
| 202 | 205 |
| 203 #endif // NET_PROXY_DHCP_SCRIPT_ADAPTER_FETCHER_WIN_H_ | 206 #endif // NET_PROXY_DHCP_SCRIPT_ADAPTER_FETCHER_WIN_H_ |
| OLD | NEW |