summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/dns_master.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 05:08:42 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-15 05:08:42 +0000
commit2884a4619edeac1787e2b1d1b57e913f7e442cae (patch)
treef194f30877c49ce17031a29393143039eacfb496 /chrome/browser/net/dns_master.cc
parent202e7a773359b24943d7de0943dd9c7d257ab1cb (diff)
downloadchromium_src-2884a4619edeac1787e2b1d1b57e913f7e442cae.zip
chromium_src-2884a4619edeac1787e2b1d1b57e913f7e442cae.tar.gz
chromium_src-2884a4619edeac1787e2b1d1b57e913f7e442cae.tar.bz2
* Move the global "DnsResolutionObserver" code depended on by DNS prefetcher, into HostResolver. This has the advantage that consumers of DNS no longer have to remember to call "DidFinishDnsResolutionWithStatus()" followed by "DidStartDnsResolution()" in order for the prefetcher to observe the resolution. Instead it just happens automatically, and subscribers register via HostResolver::AddObserver() on a particular resolver instance.
* To accomodate the prefetcher's observer, HostResolver::Resolve() needs an additional "referrer" parameter. This is slightly awkward since "referrer" has nothing to do with the actual resolve request. To simplify plumbing through this and other optional parameters, Resolve() was changed to take a "RequestInfo&" parameter in place of say {hostname, port, flags}. * Added an option to HostResolver::Resolve() for disallowing cached responses (RequestInfo::allow_cached_response). This will be used when you refresh a page, to bypass the host cache. The code to do this has been added to HttpNetworkTransaction, but is commented out pending an appropriate unit-test to verify it. BUG=14056 Review URL: http://codereview.chromium.org/125107 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18371 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/dns_master.cc')
-rw-r--r--chrome/browser/net/dns_master.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/chrome/browser/net/dns_master.cc b/chrome/browser/net/dns_master.cc
index 6151087..a256aa6 100644
--- a/chrome/browser/net/dns_master.cc
+++ b/chrome/browser/net/dns_master.cc
@@ -35,8 +35,16 @@ class DnsMaster::LookupRequest {
}
bool Start() {
- const int result = resolver_.Resolve(hostname_, 80, &addresses_,
- &net_callback_);
+ // Port doesn't really matter.
+ net::HostResolver::RequestInfo resolve_info(hostname_, 80);
+
+ // Make a note that this is a speculative resolve request. This allows us
+ // to separate it from real navigations in the observer's callback, and
+ // lets the HostResolver know it can de-prioritize it.
+ resolve_info.set_is_speculative(true);
+
+ const int result = resolver_.Resolve(
+ resolve_info, &addresses_, &net_callback_);
return (result == net::ERR_IO_PENDING);
}