diff options
author | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 23:57:54 +0000 |
---|---|---|
committer | willchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-01 23:57:54 +0000 |
commit | 73c4532bd7f5b84bc822a4acca5c5b8affef4129 (patch) | |
tree | dc2a525aab1bda568b52ea78e72c8be79b9165dc /net/base/host_resolver.h | |
parent | 3209e71131849f3e0d513cd3fd8dca881f05d531 (diff) | |
download | chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.zip chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.tar.gz chromium_src-73c4532bd7f5b84bc822a4acca5c5b8affef4129.tar.bz2 |
Stop refcounting HostResolver.
BUG=46049
TEST=none
Review URL: http://codereview.chromium.org/3601002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61256 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver.h')
-rw-r--r-- | net/base/host_resolver.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index 1c0982d..9ee345a 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -8,7 +8,7 @@ #include <string> -#include "base/ref_counted.h" +#include "base/scoped_ptr.h" #include "googleurl/src/gurl.h" #include "net/base/address_family.h" #include "net/base/completion_callback.h" @@ -31,7 +31,7 @@ class NetLog; // request at a time is to create a SingleRequestHostResolver wrapper around // HostResolver (which will automatically cancel the single request when it // goes out of scope). -class HostResolver : public base::RefCounted<HostResolver> { +class HostResolver { public: // The parameters for doing a Resolve(). A hostname and port are required, // the rest are optional (and have reasonable defaults). @@ -124,6 +124,11 @@ class HostResolver : public base::RefCounted<HostResolver> { // concurrency. static const size_t kDefaultParallelism = 0; + // If any completion callbacks are pending when the resolver is destroyed, + // the host resolutions are cancelled, and the completion callbacks will not + // be called. + virtual ~HostResolver(); + // Resolves the given hostname (or IP address literal), filling out the // |addresses| object upon success. The |info.port| parameter will be set as // the sin(6)_port field of the sockaddr_in{6} struct. Returns OK if @@ -174,15 +179,8 @@ class HostResolver : public base::RefCounted<HostResolver> { virtual void Shutdown() {} protected: - friend class base::RefCounted<HostResolver>; - HostResolver(); - // If any completion callbacks are pending when the resolver is destroyed, - // the host resolutions are cancelled, and the completion callbacks will not - // be called. - virtual ~HostResolver(); - private: DISALLOW_COPY_AND_ASSIGN(HostResolver); }; @@ -192,6 +190,7 @@ class HostResolver : public base::RefCounted<HostResolver> { // single hostname at a time and cancels this request when going out of scope. class SingleRequestHostResolver { public: + // |resolver| must remain valid for the lifetime of |this|. explicit SingleRequestHostResolver(HostResolver* resolver); // If a completion callback is pending when the resolver is destroyed, the @@ -216,7 +215,7 @@ class SingleRequestHostResolver { void OnResolveCompletion(int result); // The actual host resolver that will handle the request. - scoped_refptr<HostResolver> resolver_; + HostResolver* const resolver_; // The current request (if any). HostResolver::RequestHandle cur_request_; |