Index: net/dns/host_resolver_impl.h |
diff --git a/net/dns/host_resolver_impl.h b/net/dns/host_resolver_impl.h |
index 5c3124cba5962bce899455a799e9e77e65a10bd4..d87c40d701f74f629e4bb2a6da4daa4b20ebcb18 100644 |
--- a/net/dns/host_resolver_impl.h |
+++ b/net/dns/host_resolver_impl.h |
@@ -103,7 +103,8 @@ class NET_EXPORT HostResolverImpl |
uint32_t retry_factor; |
}; |
- // Creates a HostResolver as specified by |options|. |
+ // Creates a HostResolver as specified by |options|. Blocking tasks are run on |
+ // the WorkerPool. |
// |
// If Options.enable_caching is true, a cache is created using |
// HostCache::CreateDefaultCache(). Otherwise no cache is used. |
@@ -151,6 +152,16 @@ class NET_EXPORT HostResolverImpl |
proc_params_ = proc_params; |
} |
+ protected: |
+ // Just like the public constructor, but allows the task runner used for |
+ // blocking tasks to be specified. Intended for testing only. |
+ HostResolverImpl(const Options& options, |
+ NetLog* net_log, |
+ scoped_refptr<base::TaskRunner> worker_task_runner); |
+ |
+ // Callback from HaveOnlyLoopbackAddresses probe. |
+ void SetHaveOnlyLoopbackAddresses(bool result); |
+ |
private: |
friend class HostResolverImplTest; |
class Job; |
@@ -204,9 +215,6 @@ class NET_EXPORT HostResolverImpl |
const RequestInfo& info, |
AddressList* addresses); |
- // Callback from HaveOnlyLoopbackAddresses probe. |
- void SetHaveOnlyLoopbackAddresses(bool result); |
- |
// Returns the (hostname, address_family) key to use for |info|, choosing an |
// "effective" address family by inheriting the resolver's default address |
// family when the request leaves it unspecified. |
@@ -219,6 +227,9 @@ class NET_EXPORT HostResolverImpl |
// from the first probe for some time before probing again. |
virtual bool IsIPv6Reachable(const BoundNetLog& net_log); |
+ // Asynchronously checks if only loopback IPs are available. |
+ virtual void RunLoopbackProbeJob(); |
+ |
// Records the result in cache if cache is present. |
void CacheResult(const Key& key, |
const HostCache::Entry& entry, |
@@ -311,6 +322,11 @@ class NET_EXPORT HostResolverImpl |
// Allow fallback to ProcTask if DnsTask fails. |
bool fallback_to_proctask_; |
+ // Task runner used for DNS lookups using the platform resolver, and other |
+ // blocking operations. Usually just the worker pool's task runner for slow |
+ // tasks, but can be overridden for tests. |
+ scoped_refptr<base::TaskRunner> worker_task_runner_; |
+ |
base::WeakPtrFactory<HostResolverImpl> weak_ptr_factory_; |
base::WeakPtrFactory<HostResolverImpl> probe_weak_ptr_factory_; |