| 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 #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 <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 | 56 |
| 57 scoped_refptr<base::TaskRunner> GetTaskRunner(); | 57 scoped_refptr<base::TaskRunner> GetTaskRunner(); |
| 58 | 58 |
| 59 // This inner class encapsulate work done on a worker pool thread. | 59 // This inner class encapsulate work done on a worker pool thread. |
| 60 // The class calls GetCandidateAdapterNames, which can take a couple of | 60 // The class calls GetCandidateAdapterNames, which can take a couple of |
| 61 // hundred milliseconds. | 61 // hundred milliseconds. |
| 62 class NET_EXPORT_PRIVATE AdapterQuery | 62 class NET_EXPORT_PRIVATE AdapterQuery |
| 63 : public base::RefCountedThreadSafe<AdapterQuery> { | 63 : public base::RefCountedThreadSafe<AdapterQuery> { |
| 64 public: | 64 public: |
| 65 AdapterQuery(); | 65 AdapterQuery(); |
| 66 virtual ~AdapterQuery(); | |
| 67 | 66 |
| 68 // This is the method that runs on the worker pool thread. | 67 // This is the method that runs on the worker pool thread. |
| 69 void GetCandidateAdapterNames(); | 68 void GetCandidateAdapterNames(); |
| 70 | 69 |
| 71 // This set is valid after GetCandidateAdapterNames has | 70 // This set is valid after GetCandidateAdapterNames has |
| 72 // been run. Its lifetime is scoped by this object. | 71 // been run. Its lifetime is scoped by this object. |
| 73 const std::set<std::string>& adapter_names() const; | 72 const std::set<std::string>& adapter_names() const; |
| 74 | 73 |
| 75 protected: | 74 protected: |
| 76 // Virtual method introduced to allow unit testing. | 75 // Virtual method introduced to allow unit testing. |
| 77 virtual bool ImplGetCandidateAdapterNames( | 76 virtual bool ImplGetCandidateAdapterNames( |
| 78 std::set<std::string>* adapter_names); | 77 std::set<std::string>* adapter_names); |
| 79 | 78 |
| 79 friend class base::RefCountedThreadSafe<AdapterQuery>; |
| 80 virtual ~AdapterQuery(); |
| 81 |
| 80 private: | 82 private: |
| 81 // This is constructed on the originating thread, then used on the | 83 // This is constructed on the originating thread, then used on the |
| 82 // worker thread, then used again on the originating thread only when | 84 // worker thread, then used again on the originating thread only when |
| 83 // the task has completed on the worker thread. No locking required. | 85 // the task has completed on the worker thread. No locking required. |
| 84 std::set<std::string> adapter_names_; | 86 std::set<std::string> adapter_names_; |
| 85 | 87 |
| 86 DISALLOW_COPY_AND_ASSIGN(AdapterQuery); | 88 DISALLOW_COPY_AND_ASSIGN(AdapterQuery); |
| 87 }; | 89 }; |
| 88 | 90 |
| 89 // Virtual methods introduced to allow unit testing. | 91 // Virtual methods introduced to allow unit testing. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 | 171 |
| 170 // Worker pool we use for all DHCP lookup tasks. | 172 // Worker pool we use for all DHCP lookup tasks. |
| 171 scoped_refptr<base::SequencedWorkerPool> worker_pool_; | 173 scoped_refptr<base::SequencedWorkerPool> worker_pool_; |
| 172 | 174 |
| 173 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); | 175 DISALLOW_IMPLICIT_CONSTRUCTORS(DhcpProxyScriptFetcherWin); |
| 174 }; | 176 }; |
| 175 | 177 |
| 176 } // namespace net | 178 } // namespace net |
| 177 | 179 |
| 178 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ | 180 #endif // NET_PROXY_DHCP_PROXY_SCRIPT_FETCHER_WIN_H_ |
| OLD | NEW |