diff options
author | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 20:14:27 +0000 |
---|---|---|
committer | ericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-16 20:14:27 +0000 |
commit | 04a0f0269fc3e37cf6d79b86ca136e45d63a14b5 (patch) | |
tree | 68fdeca2da4b79d08a76a68320668852f8f4c4b6 /net/base/host_resolver.h | |
parent | 83f1b0828b19c791df2f4765296777e4bfeb60b2 (diff) | |
download | chromium_src-04a0f0269fc3e37cf6d79b86ca136e45d63a14b5.zip chromium_src-04a0f0269fc3e37cf6d79b86ca136e45d63a14b5.tar.gz chromium_src-04a0f0269fc3e37cf6d79b86ca136e45d63a14b5.tar.bz2 |
* Add an OnCancelResolution() notifier to HostResolver::Observer, so observers can tell when a request has been cancelled.
* Use OnCancelResolution() in DNS prefetcher observer, to avoid leaking entries in the |resolution| table when requests are cancelled. (BUG=14138)
* Fix a bug where completion notification wasn't being sent when the response was cached. (BUG=14188)
BUG=14138,14188
TEST=HostResolverTest.CancellationObserver, HostResolverTest.Observer
Review URL: http://codereview.chromium.org/125171
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18520 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver.h')
-rw-r--r-- | net/base/host_resolver.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h index 34c803f..0b5c3fc 100644 --- a/net/base/host_resolver.h +++ b/net/base/host_resolver.h @@ -106,13 +106,18 @@ class HostResolver { // 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(). + // to OnFinishResolutionWithStatus() or OnCancelResolution(). 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. + // cancelled, OnCancelResolution() will be called instead. virtual void OnFinishResolutionWithStatus(int id, bool was_resolved, const RequestInfo& info) = 0; + + // Called when request |id| has been cancelled. A request is "cancelled" + // if either the HostResolver is destroyed while a resolution is in + // progress, or HostResolver::CancelRequest() is called. + virtual void OnCancelResolution(int id, const RequestInfo& info) = 0; }; // Creates a HostResolver that caches up to |max_cache_entries| for @@ -175,15 +180,19 @@ class HostResolver { // Callback for when |job| has completed with |error| and |addrlist|. void OnJobComplete(Job* job, int error, const AddressList& addrlist); - // Notify all obsevers of the start of a resolve request. + // Notify all observers of the start of a resolve request. void NotifyObserversStartRequest(int request_id, const RequestInfo& info); - // Notify all obsevers of the completion of a resolve request. + // Notify all observers of the completion of a resolve request. void NotifyObserversFinishRequest(int request_id, const RequestInfo& info, int error); + // Notify all observers of the cancellation of a resolve request. + void NotifyObserversCancelRequest(int request_id, + const RequestInfo& info); + // Cache of host resolution results. HostCache cache_; |