Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1748)

Unified Diff: net/base/host_resolver.cc

Issue 21133: Revert "Clean up dns prefetch code, and also port it." (Closed)
Patch Set: Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/host_resolver.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/host_resolver.cc
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc
index 7480fdbb602184ec7203a36e9ff3f4e1eac7ba51..d5d97e77ebd803c1f4cbd7714f3cf94f16d756f5 100644
--- a/net/base/host_resolver.cc
+++ b/net/base/host_resolver.cc
@@ -63,9 +63,8 @@ static int ResolveAddrInfo(HostMapper* mapper, const std::string& host,
//-----------------------------------------------------------------------------
-class HostResolver::Request
- : public base::RefCountedThreadSafe<HostResolver::Request>,
- public MessageLoop::DestructionObserver {
+class HostResolver::Request :
+ public base::RefCountedThreadSafe<HostResolver::Request> {
public:
Request(HostResolver* resolver,
const std::string& host,
@@ -81,10 +80,9 @@ class HostResolver::Request
host_mapper_(host_mapper),
error_(OK),
results_(NULL) {
- MessageLoop::current()->AddDestructionObserver(this);
}
- virtual ~Request() {
+ ~Request() {
if (results_)
freeaddrinfo(results_);
}
@@ -113,12 +111,6 @@ class HostResolver::Request
// Running on the origin thread.
DCHECK(error_ || results_);
- {
- AutoLock locked(origin_loop_lock_);
- if (origin_loop_)
- origin_loop_->RemoveDestructionObserver(this);
- }
-
// We may have been cancelled!
if (!resolver_)
return;
@@ -143,11 +135,6 @@ class HostResolver::Request
origin_loop_ = NULL;
}
- virtual void WillDestroyCurrentMessageLoop() {
- AutoLock locked(origin_loop_lock_);
- origin_loop_ = NULL;
- }
-
private:
// Set on the origin thread, read on the worker thread.
std::string host_;
@@ -182,10 +169,8 @@ HostResolver::HostResolver() {
}
HostResolver::~HostResolver() {
- if (request_) {
+ if (request_)
request_->Cancel();
- MessageLoop::current()->RemoveDestructionObserver(request_.get());
- }
}
int HostResolver::Resolve(const std::string& hostname, int port,
@@ -210,7 +195,6 @@ int HostResolver::Resolve(const std::string& hostname, int port,
if (!WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(request_.get(), &Request::DoLookup), true)) {
NOTREACHED();
- MessageLoop::current()->RemoveDestructionObserver(request_.get());
request_ = NULL;
return ERR_FAILED;
}
« no previous file with comments | « net/base/host_resolver.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698