| 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_BASE_HOST_RESOLVER_IMPL_H_ | 5 #ifndef NET_BASE_HOST_RESOLVER_IMPL_H_ |
| 6 #define NET_BASE_HOST_RESOLVER_IMPL_H_ | 6 #define NET_BASE_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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; | 144 virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; |
| 145 virtual void ProbeIPv6Support() OVERRIDE; | 145 virtual void ProbeIPv6Support() 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; | 153 class IPv6ProbeJob; |
| 154 class LoopbackProbeJob; |
| 154 class DnsTask; | 155 class DnsTask; |
| 155 class Request; | 156 class Request; |
| 156 typedef HostCache::Key Key; | 157 typedef HostCache::Key Key; |
| 157 typedef std::map<Key, Job*> JobMap; | 158 typedef std::map<Key, Job*> JobMap; |
| 158 typedef ScopedVector<Request> RequestsList; | 159 typedef ScopedVector<Request> RequestsList; |
| 159 | 160 |
| 160 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP | 161 // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP |
| 161 // literal, cache and HOSTS lookup (if enabled), returns OK if successful, | 162 // literal, cache and HOSTS lookup (if enabled), returns OK if successful, |
| 162 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is | 163 // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is |
| 163 // incompatible, ERR_DNS_CACHE_MISS if entry was not found in cache and HOSTS. | 164 // incompatible, ERR_DNS_CACHE_MISS if entry was not found in cache and HOSTS. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 180 const RequestInfo& info, | 181 const RequestInfo& info, |
| 181 int* net_error, | 182 int* net_error, |
| 182 AddressList* addresses); | 183 AddressList* addresses); |
| 183 | 184 |
| 184 // If we have a DnsClient with a valid DnsConfig, and |key| is found in the | 185 // If we have a DnsClient with a valid DnsConfig, and |key| is found in the |
| 185 // HOSTS file, returns true and fills |addresses|. Otherwise returns false. | 186 // HOSTS file, returns true and fills |addresses|. Otherwise returns false. |
| 186 bool ServeFromHosts(const Key& key, | 187 bool ServeFromHosts(const Key& key, |
| 187 const RequestInfo& info, | 188 const RequestInfo& info, |
| 188 AddressList* addresses); | 189 AddressList* addresses); |
| 189 | 190 |
| 190 // Notifies IPv6ProbeJob not to call back, and discard reference to the job. | |
| 191 void DiscardIPv6ProbeJob(); | |
| 192 | |
| 193 // Callback from IPv6 probe activity. | 191 // Callback from IPv6 probe activity. |
| 194 void IPv6ProbeSetDefaultAddressFamily(AddressFamily address_family); | 192 void IPv6ProbeSetDefaultAddressFamily(AddressFamily address_family); |
| 195 | 193 |
| 196 // Callback from HaveOnlyLoopbackAddresses probe. | 194 // Callback from HaveOnlyLoopbackAddresses probe. |
| 197 void SetHaveOnlyLoopbackAddresses(bool result); | 195 void SetHaveOnlyLoopbackAddresses(bool result); |
| 198 | 196 |
| 199 // Returns the (hostname, address_family) key to use for |info|, choosing an | 197 // Returns the (hostname, address_family) key to use for |info|, choosing an |
| 200 // "effective" address family by inheriting the resolver's default address | 198 // "effective" address family by inheriting the resolver's default address |
| 201 // family when the request leaves it unspecified. | 199 // family when the request leaves it unspecified. |
| 202 Key GetEffectiveKeyForRequest(const RequestInfo& info) const; | 200 Key GetEffectiveKeyForRequest(const RequestInfo& info) const; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 size_t max_queued_jobs_; | 242 size_t max_queued_jobs_; |
| 245 | 243 |
| 246 // Parameters for ProcTask. | 244 // Parameters for ProcTask. |
| 247 ProcTaskParams proc_params_; | 245 ProcTaskParams proc_params_; |
| 248 | 246 |
| 249 // Address family to use when the request doesn't specify one. | 247 // Address family to use when the request doesn't specify one. |
| 250 AddressFamily default_address_family_; | 248 AddressFamily default_address_family_; |
| 251 | 249 |
| 252 base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_; | 250 base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_; |
| 253 | 251 |
| 252 base::WeakPtrFactory<HostResolverImpl> probe_weak_ptr_factory_; |
| 253 |
| 254 // If present, used by DnsTask and ServeFromHosts to resolve requests. | 254 // If present, used by DnsTask and ServeFromHosts to resolve requests. |
| 255 scoped_ptr<DnsClient> dns_client_; | 255 scoped_ptr<DnsClient> dns_client_; |
| 256 | 256 |
| 257 // True if received valid config from |dns_config_service_|. Temporary, used | 257 // True if received valid config from |dns_config_service_|. Temporary, used |
| 258 // to measure performance of DnsConfigService: http://crbug.com/125599 | 258 // to measure performance of DnsConfigService: http://crbug.com/125599 |
| 259 bool received_dns_config_; | 259 bool received_dns_config_; |
| 260 | 260 |
| 261 // Indicate if probing is done after each network change event to set address | 261 // Indicate if probing is done after each network change event to set address |
| 262 // family. When false, explicit setting of address family is used. | 262 // family. When false, explicit setting of address family is used. |
| 263 bool ipv6_probe_monitoring_; | 263 bool ipv6_probe_monitoring_; |
| 264 | 264 |
| 265 // The last un-cancelled IPv6ProbeJob (if any). | |
| 266 scoped_refptr<IPv6ProbeJob> ipv6_probe_job_; | |
| 267 | |
| 268 // Any resolver flags that should be added to a request by default. | 265 // Any resolver flags that should be added to a request by default. |
| 269 HostResolverFlags additional_resolver_flags_; | 266 HostResolverFlags additional_resolver_flags_; |
| 270 | 267 |
| 271 NetLog* net_log_; | 268 NetLog* net_log_; |
| 272 | 269 |
| 273 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); | 270 DISALLOW_COPY_AND_ASSIGN(HostResolverImpl); |
| 274 }; | 271 }; |
| 275 | 272 |
| 276 } // namespace net | 273 } // namespace net |
| 277 | 274 |
| 278 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ | 275 #endif // NET_BASE_HOST_RESOLVER_IMPL_H_ |
| OLD | NEW |