diff options
author | agayev@chromium.org <agayev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-04 21:50:40 +0000 |
---|---|---|
committer | agayev@chromium.org <agayev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-04 21:50:40 +0000 |
commit | 95a214cd9711f435d3c964df768d394163e5c353 (patch) | |
tree | 000931469e217e37f27a93342f30408350367127 /net/base/host_resolver_impl.h | |
parent | 8e42ba22706ce8ca0fd374351f4221a26ebd5e0a (diff) | |
download | chromium_src-95a214cd9711f435d3c964df768d394163e5c353.zip chromium_src-95a214cd9711f435d3c964df768d394163e5c353.tar.gz chromium_src-95a214cd9711f435d3c964df768d394163e5c353.tar.bz2 |
HostResolver: don't interpret NULL callback argument as a request to do synchronous resolution.
BUG=90547,60149
TEST=net_unittests
Review URL: http://codereview.chromium.org/7492059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95509 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_impl.h')
-rw-r--r-- | net/base/host_resolver_impl.h | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h index a6f5220..4fe298d 100644 --- a/net/base/host_resolver_impl.h +++ b/net/base/host_resolver_impl.h @@ -137,16 +137,19 @@ class NET_API HostResolverImpl AddressList* addresses, CompletionCallback* callback, RequestHandle* out_req, - const BoundNetLog& source_net_log); - virtual void CancelRequest(RequestHandle req); - virtual void AddObserver(HostResolver::Observer* observer); - virtual void RemoveObserver(HostResolver::Observer* observer); + const BoundNetLog& source_net_log) OVERRIDE; + virtual int ResolveFromCache(const RequestInfo& info, + AddressList* addresses, + const BoundNetLog& source_net_log) OVERRIDE; + virtual void CancelRequest(RequestHandle req) OVERRIDE; + virtual void AddObserver(HostResolver::Observer* observer) OVERRIDE; + virtual void RemoveObserver(HostResolver::Observer* observer) OVERRIDE; // Set address family, and disable IPv6 probe support. - virtual void SetDefaultAddressFamily(AddressFamily address_family); - virtual AddressFamily GetDefaultAddressFamily() const; + virtual void SetDefaultAddressFamily(AddressFamily address_family) OVERRIDE; + virtual AddressFamily GetDefaultAddressFamily() const OVERRIDE; - virtual HostResolverImpl* GetAsHostResolverImpl(); + virtual HostResolverImpl* GetAsHostResolverImpl() OVERRIDE; private: // Allow tests to access our innards for testing purposes. @@ -164,6 +167,33 @@ class NET_API HostResolverImpl typedef std::map<Key, scoped_refptr<Job> > JobMap; typedef std::vector<HostResolver::Observer*> ObserversList; + // Helper used by |Resolve()| and |ResolveFromCache()|. Performs IP + // literal and cache lookup, returns OK if successfull, + // ERR_NAME_NOT_RESOLVED if either hostname is invalid or IP literal is + // incompatible, ERR_DNS_CACHE_MISS if entry was not found in cache. + int ResolveHelper(int request_id, + const Key& key, + const RequestInfo& info, + AddressList* addresses, + const BoundNetLog& request_net_log, + const BoundNetLog& source_net_log); + + // Tries to resolve |key| as an IP, returns true and sets |net_error| if + // succeeds, returns false otherwise. + bool ResolveAsIP(const Key& key, + const RequestInfo& info, + int* net_error, + AddressList* addresses); + + // If |key| is not found in cache returns false, otherwise returns + // true, sets |net_error| to the cached error code and fills |addresses| + // if it is a positive entry. + bool ServeFromCache(const Key& key, + const RequestInfo& info, + const BoundNetLog& request_net_log, + int* net_error, + AddressList* addresses); + // Returns the HostResolverProc to use for this instance. HostResolverProc* effective_resolver_proc() const { return resolver_proc_ ? |