summaryrefslogtreecommitdiffstats
path: root/net/base/host_resolver_impl.h
diff options
context:
space:
mode:
authorszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 03:34:35 +0000
committerszym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-08 03:34:35 +0000
commit16ee26d5da61ae182160d491be3a5062b3077279 (patch)
tree77b9e323c9913c99c331f233d28f79a11a88f59b /net/base/host_resolver_impl.h
parent0f3044efb1755f0b846ef0f3d015bb8ab8a3c957 (diff)
downloadchromium_src-16ee26d5da61ae182160d491be3a5062b3077279.zip
chromium_src-16ee26d5da61ae182160d491be3a5062b3077279.tar.gz
chromium_src-16ee26d5da61ae182160d491be3a5062b3077279.tar.bz2
[net] Refactoring of HostResolverImpl::Job::CompleteRequests.
- Job::CompleteRequests is the common exit path for all cases except when HostResolverImpl is destroyed. - Replaced HostResolverImpl::OnJobFinished with ::CacheResult which is more explicit. - Since priority is not needed at construction, it's removed from Job and PriorityTracker constructors. - Also fixing HostResolverImplTest.CanceledRequestsReleaseJobSlots by replacing MessageLoop::AssertIdle with a more specific check. BUG=117187 TEST=./net_unittests --gtest_filter=HostResolverImplTest.* Review URL: http://codereview.chromium.org/9580029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@125539 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/host_resolver_impl.h')
-rw-r--r--net/base/host_resolver_impl.h18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index fbf67bc..dd8c70e 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -148,6 +148,11 @@ class NET_EXPORT HostResolverImpl
virtual void ProbeIPv6Support() OVERRIDE;
virtual HostCache* GetHostCache() OVERRIDE;
+ // Allows the tests to catch slots leaking out of the dispatcher.
+ size_t num_running_jobs_for_tests() const {
+ return dispatcher_.num_running_jobs();
+ }
+
private:
class Job;
class ProcTask;
@@ -194,14 +199,13 @@ class NET_EXPORT HostResolverImpl
// family when the request leaves it unspecified.
Key GetEffectiveKeyForRequest(const RequestInfo& info) const;
- // Called by |job| when it has completed. Records the result in cache
- // if necessary and dispatches another job if possible.
- void OnJobFinished(Job* job,
- int net_error,
- const AddressList& addr_list,
- base::TimeDelta ttl);
+ // Records the result in cache if cache is present.
+ void CacheResult(const Key& key,
+ int net_error,
+ const AddressList& addr_list,
+ base::TimeDelta ttl);
- // Removes |job| from |jobs_|.
+ // Removes |job| from |jobs_|, only if it exists.
void RemoveJob(Job* job);
// Aborts all in progress jobs and notifies their requests.