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

Unified Diff: net/base/host_resolver_impl.h

Issue 7492059: HostResolver: don't interpret NULL callback argument as a request to do synchronous resolution. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged common code from Resolve and ResolveFromCache to a single function. Created 9 years, 4 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
Index: net/base/host_resolver_impl.h
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index a6f5220ef80b2b33852fdf51224cf9edbd51ad6e..4fe298d843986a18ea0998b6e6495c5e50740a98 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_ ?

Powered by Google App Engine
This is Rietveld 408576698