Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: net/base/host_resolver_impl.h

Issue 9667025: [net/dns] Serve requests from HOSTS file if possible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to trunk. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/base/host_resolver_impl.cc » ('j') | net/base/host_resolver_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver_impl.h
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index dd8c70e334c285d75ff72691e1a5e0c51b9e10b4..16b304f4d706dd421550abe8f159cb8d0f1d451a 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -23,12 +23,11 @@
#include "net/base/net_log.h"
#include "net/base/network_change_notifier.h"
#include "net/base/prioritized_dispatcher.h"
+#include "net/dns/dns_client.h"
#include "net/dns/dns_config_service.h"
namespace net {
-class DnsTransactionFactory;
-
// For each hostname that is requested, HostResolver creates a
// HostResolverImpl::Job. When this job gets dispatched it creates a ProcTask
// which runs the given HostResolverProc on a WorkerPool thread. If requests for
@@ -153,6 +152,10 @@ class NET_EXPORT HostResolverImpl
return dispatcher_.num_running_jobs();
}
+ void set_dns_client_for_tests(scoped_ptr<DnsClient> client) {
mmenke 2012/03/13 15:56:27 Suggest you make this and the above function priva
szym 2012/03/13 20:06:42 Not a fan of FRIEND_TEST*. It completely opens the
mmenke 2012/03/13 20:31:08 SGTM. I prefer just friending the fixture as well
+ dns_client_ = client.Pass();
+ }
+
private:
class Job;
class ProcTask;
@@ -184,10 +187,15 @@ class NET_EXPORT HostResolverImpl
// if it is a positive entry.
bool ServeFromCache(const Key& key,
const RequestInfo& info,
- const BoundNetLog& request_net_log,
int* net_error,
AddressList* addresses);
+ // If |key| is not found in the HOSTS file or no HOSTS file known, returns
+ // false, otherwise returns true and fills |addresses|.
+ bool ServeFromHosts(const Key& key,
+ const RequestInfo& info,
+ AddressList* addresses);
+
// Notifies IPv6ProbeJob not to call back, and discard reference to the job.
void DiscardIPv6ProbeJob();
@@ -212,6 +220,9 @@ class NET_EXPORT HostResolverImpl
// Might start new jobs.
void AbortAllInProgressJobs();
+ // Attempts to serve each Job in |jobs_| from the HOSTS file.
+ void TryServingAllJobsFromHosts();
+
// NetworkChangeNotifier::IPAddressObserver:
virtual void OnIPAddressChanged() OVERRIDE;
@@ -221,6 +232,9 @@ class NET_EXPORT HostResolverImpl
// DnsConfigService::Observer:
virtual void OnConfigChanged(const DnsConfig& dns_config) OVERRIDE;
+ // True if have fully configured DNS client.
+ bool HaveDnsConfig() const;
+
// Cache of host resolution results.
scoped_ptr<HostCache> cache_;
@@ -236,11 +250,10 @@ class NET_EXPORT HostResolverImpl
// Parameters for ProcTask.
ProcTaskParams proc_params_;
- scoped_ptr<DnsTransactionFactory> dns_transaction_factory_;
-
// Address family to use when the request doesn't specify one.
AddressFamily default_address_family_;
+ scoped_ptr<DnsClient> dns_client_;
scoped_ptr<DnsConfigService> dns_config_service_;
// Indicate if probing is done after each network change event to set address
« no previous file with comments | « no previous file | net/base/host_resolver_impl.cc » ('j') | net/base/host_resolver_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698