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_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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "base/message_loop_proxy.h" | 14 #include "base/message_loop_proxy.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/threading/non_thread_safe.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "base/timer.h" | 17 #include "base/timer.h" |
18 #include "net/proxy/dhcp_proxy_script_fetcher.h" | 18 #include "net/proxy/dhcp_proxy_script_fetcher.h" |
19 | 19 |
20 namespace net { | 20 namespace net { |
21 | 21 |
22 class DhcpProxyScriptAdapterFetcher; | 22 class DhcpProxyScriptAdapterFetcher; |
23 class URLRequestContext; | 23 class URLRequestContext; |
24 | 24 |
25 // Windows-specific implementation. | 25 // Windows-specific implementation. |
26 class NET_TEST DhcpProxyScriptFetcherWin | 26 class NET_EXPORT_PRIVATE DhcpProxyScriptFetcherWin |
27 : public DhcpProxyScriptFetcher, | 27 : public DhcpProxyScriptFetcher, |
28 public base::SupportsWeakPtr<DhcpProxyScriptFetcherWin>, | 28 public base::SupportsWeakPtr<DhcpProxyScriptFetcherWin>, |
29 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 29 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
30 public: | 30 public: |
31 // Creates a DhcpProxyScriptFetcherWin that issues requests through | 31 // Creates a DhcpProxyScriptFetcherWin that issues requests through |
32 // |url_request_context|. |url_request_context| must remain valid for | 32 // |url_request_context|. |url_request_context| must remain valid for |
33 // the lifetime of DhcpProxyScriptFetcherWin. | 33 // the lifetime of DhcpProxyScriptFetcherWin. |
34 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context); | 34 explicit DhcpProxyScriptFetcherWin(URLRequestContext* url_request_context); |
35 virtual ~DhcpProxyScriptFetcherWin(); | 35 virtual ~DhcpProxyScriptFetcherWin(); |
36 | 36 |
(...skipping 12 matching lines...) Expand all Loading... |
49 int num_pending_fetchers() const; | 49 int num_pending_fetchers() const; |
50 | 50 |
51 URLRequestContext* url_request_context() const; | 51 URLRequestContext* url_request_context() const; |
52 | 52 |
53 // This inner class is used to encapsulate a worker thread that calls | 53 // This inner class is used to encapsulate a worker thread that calls |
54 // GetCandidateAdapterNames as it can take a couple of hundred | 54 // GetCandidateAdapterNames as it can take a couple of hundred |
55 // milliseconds. | 55 // milliseconds. |
56 // | 56 // |
57 // TODO(joi): Replace with PostTaskAndReply once http://crbug.com/86301 | 57 // TODO(joi): Replace with PostTaskAndReply once http://crbug.com/86301 |
58 // has been implemented. | 58 // has been implemented. |
59 class NET_TEST WorkerThread | 59 class NET_EXPORT_PRIVATE WorkerThread |
60 : public base::RefCountedThreadSafe<WorkerThread> { | 60 : public base::RefCountedThreadSafe<WorkerThread> { |
61 public: | 61 public: |
62 // Creates and initializes (but does not start) the worker thread. | 62 // Creates and initializes (but does not start) the worker thread. |
63 explicit WorkerThread( | 63 explicit WorkerThread( |
64 const base::WeakPtr<DhcpProxyScriptFetcherWin>& owner); | 64 const base::WeakPtr<DhcpProxyScriptFetcherWin>& owner); |
65 virtual ~WorkerThread(); | 65 virtual ~WorkerThread(); |
66 | 66 |
67 // Starts the worker thread. | 67 // Starts the worker thread. |
68 void Start(); | 68 void Start(); |
69 | 69 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 187 |
188 // Time |Fetch()| was last called, 0 if never. | 188 // Time |Fetch()| was last called, 0 if never. |
189 base::TimeTicks fetch_start_time_; | 189 base::TimeTicks fetch_start_time_; |
190 | 190 |
191 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); | 191 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); |
192 }; | 192 }; |
193 | 193 |
194 } // namespace net | 194 } // namespace net |
195 | 195 |
196 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ | 196 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ |
OLD | NEW |