diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-15 06:09:41 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-15 06:09:41 +0000 |
commit | 291a8adf16a35fdf4ecddbd802bc4cc1f4575096 (patch) | |
tree | 84e38cb99c9b2339a527d389ba4878396a89db59 /net/base/host_resolver.h | |
parent | 2884a4619edeac1787e2b1d1b57e913f7e442cae (diff) | |
download | chromium_src-291a8adf16a35fdf4ecddbd802bc4cc1f4575096.zip chromium_src-291a8adf16a35fdf4ecddbd802bc4cc1f4575096.tar.gz chromium_src-291a8adf16a35fdf4ecddbd802bc4cc1f4575096.tar.bz2 |
[Refactor] Rename DnsResolutionObserver --> HostResolver::Observer.
TEST=this is striclty a refactoring; just needs to compile and pass existing tests.
BUG=14056
Review URL: http://codereview.chromium.org/126110
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver.h')
-rw-r--r-- | net/base/host_resolver.h | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index 9a7b7b9..34c803f 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -20,7 +20,6 @@ class MessageLoop; namespace net { class AddressList; -class DnsResolutionObserver; class HostMapper; // This class represents the task of resolving hostnames (or IP address @@ -100,6 +99,22 @@ class HostResolver { GURL referrer_; }; + // Interface for observing the requests that flow through a HostResolver. + class Observer { + public: + virtual ~Observer() {} + + // Called at the start of HostResolver::Resolve(). |id| is a unique number + // given to the request, so it can be matched up with a corresponding call + // to OnFinishResolutionWithStatus(). + virtual void OnStartResolution(int id, const RequestInfo& info) = 0; + + // Called on completion of request |id|. Note that if the request was + // cancelled, OnFinishResolutionWithStatus() will not be called. + virtual void OnFinishResolutionWithStatus(int id, bool was_resolved, + const RequestInfo& info) = 0; + }; + // Creates a HostResolver that caches up to |max_cache_entries| for // |cache_duration_ms| milliseconds. // @@ -137,16 +152,16 @@ class HostResolver { // Adds an observer to this resolver. The observer will be notified of the // start and completion of all requests (excluding cancellation). |observer| // must remain valid for the duration of this HostResolver's lifetime. - void AddObserver(DnsResolutionObserver* observer); + void AddObserver(Observer* observer); // Unregisters an observer previously added by AddObserver(). - void RemoveObserver(DnsResolutionObserver* observer); + void RemoveObserver(Observer* observer); private: class Job; typedef std::vector<Request*> RequestsList; typedef base::hash_map<std::string, scoped_refptr<Job> > JobMap; - typedef std::vector<DnsResolutionObserver*> ObserversList; + typedef std::vector<Observer*> ObserversList; // Adds a job to outstanding jobs list. void AddOutstandingJob(Job* job); |