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_POLLING_PROXY_CONFIG_SERVICE_H_ | 5 #ifndef NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ |
6 #define NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ | 6 #define NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 protected: | 28 protected: |
29 // Function for retrieving the current proxy configuration. | 29 // Function for retrieving the current proxy configuration. |
30 // Implementors must be threadsafe as the function will be invoked from | 30 // Implementors must be threadsafe as the function will be invoked from |
31 // worker threads. | 31 // worker threads. |
32 typedef void (*GetConfigFunction)(ProxyConfig*); | 32 typedef void (*GetConfigFunction)(ProxyConfig*); |
33 | 33 |
34 // Creates a polling-based ProxyConfigService which will test for new | 34 // Creates a polling-based ProxyConfigService which will test for new |
35 // settings at most every |poll_interval| time by calling |get_config_func| | 35 // settings at most every |poll_interval| time by calling |get_config_func| |
36 // on a worker thread. | 36 // on a worker thread. |
37 PollingProxyConfigService( | 37 PollingProxyConfigService(base::TimeDelta poll_interval, |
38 base::TimeDelta poll_interval, | 38 GetConfigFunction get_config_func); |
39 GetConfigFunction get_config_func); | |
40 | 39 |
41 virtual ~PollingProxyConfigService(); | 40 virtual ~PollingProxyConfigService(); |
42 | 41 |
43 // Polls for changes by posting a task to the worker pool. | 42 // Polls for changes by posting a task to the worker pool. |
44 void CheckForChangesNow(); | 43 void CheckForChangesNow(); |
45 | 44 |
46 private: | 45 private: |
47 class Core; | 46 class Core; |
48 scoped_refptr<Core> core_; | 47 scoped_refptr<Core> core_; |
49 | 48 |
50 DISALLOW_COPY_AND_ASSIGN(PollingProxyConfigService); | 49 DISALLOW_COPY_AND_ASSIGN(PollingProxyConfigService); |
51 }; | 50 }; |
52 | 51 |
53 } // namespace net | 52 } // namespace net |
54 | 53 |
55 #endif // NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ | 54 #endif // NET_PROXY_POLLING_PROXY_CONFIG_SERVICE_H_ |
OLD | NEW |