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_DNS_DNS_CONFIG_SERVICE_H_ | 5 #ifndef NET_DNS_DNS_CONFIG_SERVICE_H_ |
6 #define NET_DNS_DNS_CONFIG_SERVICE_H_ | 6 #define NET_DNS_DNS_CONFIG_SERVICE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
15 #include "base/threading/non_thread_safe.h" | 15 #include "base/sequence_checker.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
18 // Needed on shared build with MSVS2010 to avoid multiple definitions of | 18 // Needed on shared build with MSVS2010 to avoid multiple definitions of |
19 // std::vector<IPEndPoint>. | 19 // std::vector<IPEndPoint>. |
20 #include "net/base/address_list.h" | 20 #include "net/base/address_list.h" |
21 #include "net/base/ip_endpoint.h" // win requires size of IPEndPoint | 21 #include "net/base/ip_endpoint.h" // win requires size of IPEndPoint |
22 #include "net/base/net_export.h" | 22 #include "net/base/net_export.h" |
23 #include "net/dns/dns_hosts.h" | 23 #include "net/dns/dns_hosts.h" |
24 | 24 |
25 namespace base { | 25 namespace base { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 bool edns0; | 85 bool edns0; |
86 | 86 |
87 // Indicates system configuration uses local IPv6 connectivity, e.g., | 87 // Indicates system configuration uses local IPv6 connectivity, e.g., |
88 // DirectAccess. This is exposed for HostResolver to skip IPv6 probes, | 88 // DirectAccess. This is exposed for HostResolver to skip IPv6 probes, |
89 // as it may cause them to return incorrect results. | 89 // as it may cause them to return incorrect results. |
90 bool use_local_ipv6; | 90 bool use_local_ipv6; |
91 }; | 91 }; |
92 | 92 |
93 // Service for reading system DNS settings, on demand or when signalled by | 93 // Service for reading system DNS settings, on demand or when signalled by |
94 // internal watchers and NetworkChangeNotifier. | 94 // internal watchers and NetworkChangeNotifier. |
95 class NET_EXPORT_PRIVATE DnsConfigService | 95 class NET_EXPORT_PRIVATE DnsConfigService { |
96 : NON_EXPORTED_BASE(public base::NonThreadSafe) { | |
97 public: | 96 public: |
98 // Callback interface for the client, called on the same thread as | 97 // Callback interface for the client, called on the same thread as |
99 // ReadConfig() and WatchConfig(). | 98 // ReadConfig() and WatchConfig(). |
100 typedef base::Callback<void(const DnsConfig& config)> CallbackType; | 99 typedef base::Callback<void(const DnsConfig& config)> CallbackType; |
101 | 100 |
102 // Creates the platform-specific DnsConfigService. | 101 // Creates the platform-specific DnsConfigService. |
103 static std::unique_ptr<DnsConfigService> CreateSystemService(); | 102 static std::unique_ptr<DnsConfigService> CreateSystemService(); |
104 | 103 |
105 DnsConfigService(); | 104 DnsConfigService(); |
106 virtual ~DnsConfigService(); | 105 virtual ~DnsConfigService(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 166 |
168 // Initialized and updated on Invalidate* call. | 167 // Initialized and updated on Invalidate* call. |
169 base::TimeTicks last_invalidate_config_time_; | 168 base::TimeTicks last_invalidate_config_time_; |
170 base::TimeTicks last_invalidate_hosts_time_; | 169 base::TimeTicks last_invalidate_hosts_time_; |
171 // Initialized and updated when |timer_| expires. | 170 // Initialized and updated when |timer_| expires. |
172 base::TimeTicks last_sent_empty_time_; | 171 base::TimeTicks last_sent_empty_time_; |
173 | 172 |
174 // Started in Invalidate*, cleared in On*Read. | 173 // Started in Invalidate*, cleared in On*Read. |
175 base::OneShotTimer timer_; | 174 base::OneShotTimer timer_; |
176 | 175 |
| 176 SEQUENCE_CHECKER(sequence_checker_); |
| 177 |
177 DISALLOW_COPY_AND_ASSIGN(DnsConfigService); | 178 DISALLOW_COPY_AND_ASSIGN(DnsConfigService); |
178 }; | 179 }; |
179 | 180 |
180 } // namespace net | 181 } // namespace net |
181 | 182 |
182 #endif // NET_DNS_DNS_CONFIG_SERVICE_H_ | 183 #endif // NET_DNS_DNS_CONFIG_SERVICE_H_ |
OLD | NEW |