diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-15 05:08:42 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-15 05:08:42 +0000 |
commit | 2884a4619edeac1787e2b1d1b57e913f7e442cae (patch) | |
tree | f194f30877c49ce17031a29393143039eacfb496 /net/proxy | |
parent | 202e7a773359b24943d7de0943dd9c7d257ab1cb (diff) | |
download | chromium_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 'net/proxy')
-rw-r--r-- | net/proxy/proxy_resolver_v8.cc | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/net/proxy/proxy_resolver_v8.cc b/net/proxy/proxy_resolver_v8.cc index 38e0a83..ad4f1eb6 100644 --- a/net/proxy/proxy_resolver_v8.cc +++ b/net/proxy/proxy_resolver_v8.cc @@ -70,15 +70,16 @@ class SyncHostResolverBridge // Run the resolve on host_resolver_loop, and wait for result. int Resolve(const std::string& hostname, net::AddressList* addresses) { - int kPort = 80; // Doesn't matter. + // Port number doesn't matter. + HostResolver::RequestInfo info(hostname, 80); // Hack for tests -- run synchronously on current thread. if (!host_resolver_loop_) - return host_resolver_->Resolve(hostname, kPort, addresses, NULL, NULL); + return host_resolver_->Resolve(info, addresses, NULL, NULL); // Otherwise start an async resolve on the resolver's thread. host_resolver_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, - &SyncHostResolverBridge::StartResolve, hostname, kPort, addresses)); + &SyncHostResolverBridge::StartResolve, info, addresses)); // Wait for the resolve to complete in the resolver's thread. event_.Wait(); @@ -87,12 +88,10 @@ class SyncHostResolverBridge private: // Called on host_resolver_loop_. - void StartResolve(const std::string& hostname, - int port, + void StartResolve(const HostResolver::RequestInfo& info, net::AddressList* addresses) { DCHECK_EQ(host_resolver_loop_, MessageLoop::current()); - int error = host_resolver_->Resolve( - hostname, port, addresses, &callback_, NULL); + int error = host_resolver_->Resolve(info, addresses, &callback_, NULL); if (error != ERR_IO_PENDING) OnResolveCompletion(error); // Completed synchronously. } |