Chromium Code Reviews| 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_HOST_RESOLVER_IMPL_H_ | 5 #ifndef NET_DNS_HOST_RESOLVER_IMPL_H_ |
| 6 #define NET_DNS_HOST_RESOLVER_IMPL_H_ | 6 #define NET_DNS_HOST_RESOLVER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 AddressList* addresses, | 134 AddressList* addresses, |
| 135 const CompletionCallback& callback, | 135 const CompletionCallback& callback, |
| 136 RequestHandle* out_req, | 136 RequestHandle* out_req, |
| 137 const BoundNetLog& source_net_log) OVERRIDE; | 137 const BoundNetLog& source_net_log) OVERRIDE; |
| 138 virtual int ResolveFromCache(const RequestInfo& info, | 138 virtual int ResolveFromCache(const RequestInfo& info, |
| 139 AddressList* addresses, | 139 AddressList* addresses, |
| 140 const BoundNetLog& source_net_log) OVERRIDE; | 140 const BoundNetLog& source_net_log) OVERRIDE; |
| 141 virtual void CancelRequest(RequestHandle req) OVERRIDE; | 141 virtual void CancelRequest(RequestHandle req) OVERRIDE; |
| 142 virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE; | 142 virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE; |
| 143 virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; | 143 virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; |
| 144 virtual void ProbeIPv6Support() OVERRIDE; | 144 virtual void ProbeIPv6Support() OVERRIDE; |
|
mmenke
2013/07/16 17:48:04
Documentation of this function in host_resolver co
szym
2013/07/16 20:08:31
Removed.
| |
| 145 virtual void SetDnsClientEnabled(bool enabled) OVERRIDE; | 145 virtual void SetDnsClientEnabled(bool enabled) OVERRIDE; |
| 146 virtual HostCache* GetHostCache() OVERRIDE; | 146 virtual HostCache* GetHostCache() OVERRIDE; |
| 147 virtual base::Value* GetDnsConfigAsValue() const OVERRIDE; | 147 virtual base::Value* GetDnsConfigAsValue() const OVERRIDE; |
| 148 | 148 |
| 149 private: | 149 private: |
| 150 friend class HostResolverImplTest; | 150 friend class HostResolverImplTest; |
| 151 class Job; | 151 class Job; |
| 152 class ProcTask; | 152 class ProcTask; |
| 153 class IPv6ProbeJob; | |
| 154 class LoopbackProbeJob; | 153 class LoopbackProbeJob; |
| 155 class DnsTask; | 154 class DnsTask; |
| 156 class Request; | 155 class Request; |
| 157 typedef HostCache::Key Key; | 156 typedef HostCache::Key Key; |
| 158 typedef std::map<Key, Job*> JobMap; | 157 typedef std::map<Key, Job*> JobMap; |
| 159 typedef ScopedVector<Request> RequestsList; | 158 typedef ScopedVector<Request> RequestsList; |
| 160 | 159 |
| 161 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP | 160 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP |
| 162 // literal, cache and HOSTS lookup (if enabled), returns OK if successful, | 161 // literal, cache and HOSTS lookup (if enabled), returns OK if successful, |
| 163 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is | 162 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 181 const RequestInfo& info, | 180 const RequestInfo& info, |
| 182 int* net_error, | 181 int* net_error, |
| 183 AddressList* addresses); | 182 AddressList* addresses); |
| 184 | 183 |
| 185 // If we have a DnsClient with a valid DnsConfig, and |key| is found in the | 184 // If we have a DnsClient with a valid DnsConfig, and |key| is found in the |
| 186 // HOSTS file, returns true and fills |addresses|. Otherwise returns false. | 185 // HOSTS file, returns true and fills |addresses|. Otherwise returns false. |
| 187 bool ServeFromHosts(const Key& key, | 186 bool ServeFromHosts(const Key& key, |
| 188 const RequestInfo& info, | 187 const RequestInfo& info, |
| 189 AddressList* addresses); | 188 AddressList* addresses); |
| 190 | 189 |
| 191 // Callback from IPv6 probe activity. | |
| 192 void IPv6ProbeSetDefaultAddressFamily(AddressFamily address_family); | |
| 193 | |
| 194 // Callback from HaveOnlyLoopbackAddresses probe. | 190 // Callback from HaveOnlyLoopbackAddresses probe. |
| 195 void SetHaveOnlyLoopbackAddresses(bool result); | 191 void SetHaveOnlyLoopbackAddresses(bool result); |
| 196 | 192 |
| 197 // Returns the (hostname, address_family) key to use for |info|, choosing an | 193 // Returns the (hostname, address_family) key to use for |info|, choosing an |
| 198 // "effective" address family by inheriting the resolver's default address | 194 // "effective" address family by inheriting the resolver's default address |
| 199 // family when the request leaves it unspecified. | 195 // family when the request leaves it unspecified. |
| 200 Key GetEffectiveKeyForRequest(const RequestInfo& info) const; | 196 Key GetEffectiveKeyForRequest(const RequestInfo& info) const; |
| 201 | 197 |
| 202 // Records the result in cache if cache is present. | 198 // Records the result in cache if cache is present. |
| 203 void CacheResult(const Key& key, | 199 void CacheResult(const Key& key, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 // True if received valid config from |dns_config_service_|. Temporary, used | 259 // True if received valid config from |dns_config_service_|. Temporary, used |
| 264 // to measure performance of DnsConfigService: http://crbug.com/125599 | 260 // to measure performance of DnsConfigService: http://crbug.com/125599 |
| 265 bool received_dns_config_; | 261 bool received_dns_config_; |
| 266 | 262 |
| 267 // Number of consecutive failures of DnsTask, counted when fallback succeeds. | 263 // Number of consecutive failures of DnsTask, counted when fallback succeeds. |
| 268 unsigned num_dns_failures_; | 264 unsigned num_dns_failures_; |
| 269 | 265 |
| 270 // Indicate if probing is done after each network change event to set address | 266 // Indicate if probing is done after each network change event to set address |
| 271 // family. When false, explicit setting of address family is used and results | 267 // family. When false, explicit setting of address family is used and results |
| 272 // of the IPv6 probe job are ignored. | 268 // of the IPv6 probe job are ignored. |
| 273 bool ipv6_probe_monitoring_; | 269 bool ipv6_probe_monitoring_; |
|
mmenke
2013/07/16 17:48:04
This variable name is wrong, as is the comment. S
szym
2013/07/16 20:08:31
Done.
| |
| 274 | 270 |
| 275 // True iff ProcTask has successfully resolved a hostname known to have IPv6 | 271 // True iff ProcTask has successfully resolved a hostname known to have IPv6 |
| 276 // addresses using ADDRESS_FAMILY_UNSPECIFIED. Reset on IP address change. | 272 // addresses using ADDRESS_FAMILY_UNSPECIFIED. Reset on IP address change. |
| 277 bool resolved_known_ipv6_hostname_; | 273 bool resolved_known_ipv6_hostname_; |
| 278 | 274 |
| 279 // Any resolver flags that should be added to a request by default. | 275 // Any resolver flags that should be added to a request by default. |
| 280 HostResolverFlags additional_resolver_flags_; | 276 HostResolverFlags additional_resolver_flags_; |
| 281 | 277 |
| 282 // Allow fallback to ProcTask if DnsTask fails. | 278 // Allow fallback to ProcTask if DnsTask fails. |
| 283 bool fallback_to_proctask_; | 279 bool fallback_to_proctask_; |
| 284 | 280 |
| 285 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 281 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
| 286 }; | 282 }; |
| 287 | 283 |
| 288 } // namespace net | 284 } // namespace net |
| 289 | 285 |
| 290 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ | 286 #endif // NET_DNS_HOST_RESOLVER_IMPL_H_ |
| OLD | NEW |