From e1fd94e100fa5e8bf34b8abab59c5bb5668026fa Mon Sep 17 00:00:00 2001 From: "wtc@chromium.org" Date: Tue, 4 Jan 2011 23:09:01 +0000 Subject: Make the comment at the top of the file match the code. Remove the unused RRResolverJob::Cancel method. Remove job from inflight_ if worker cannot be started. R=agl BUG=none TEST=none Review URL: http://codereview.chromium.org/5574008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70460 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/dnsrr_resolver.cc | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) (limited to 'net') diff --git a/net/base/dnsrr_resolver.cc b/net/base/dnsrr_resolver.cc index 393c213..14b7b93 100644 --- a/net/base/dnsrr_resolver.cc +++ b/net/base/dnsrr_resolver.cc @@ -26,10 +26,10 @@ // | (origin loop) (worker loop) // | // Resolve() -// |---->---- -// | // |---->------------------- // | +// |---->---- +// | // |---->--------------------------------------------------- // | // |---->--------------------Start @@ -58,11 +58,9 @@ // // A cache hit: // -// DnsRRResolver CacheHitCallbackTask Handle +// DnsRRResolver Handle // | // Resolve() -// |---->---- -// | // |---->------------------------ // | // | @@ -70,9 +68,7 @@ // // (MessageLoop cycles) // -// Run -// | -// |----->-----------Post +// Post @@ -559,7 +555,11 @@ class RRResolverJob { } ~RRResolverJob() { - Cancel(ERR_ABORTED); + if (worker_) { + worker_->Cancel(); + worker_ = NULL; + PostAll(ERR_ABORTED, NULL); + } } void AddHandle(RRResolverHandle* handle) { @@ -571,14 +571,6 @@ class RRResolverJob { PostAll(result, &response); } - void Cancel(int error) { - if (worker_) { - worker_->Cancel(); - worker_ = NULL; - PostAll(error, NULL); - } - } - private: void PostAll(int result, const RRResponse* response) { std::vector handles; @@ -669,6 +661,7 @@ intptr_t DnsRRResolver::Resolve(const std::string& name, uint16 rrtype, job = new RRResolverJob(worker); inflight_.insert(make_pair(key, job)); if (!worker->Start()) { + inflight_.erase(key); delete job; delete worker; return kInvalidHandle; -- cgit v1.1