summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-06 19:03:29 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-02-06 19:03:29 +0000
commitb2b8b8313cf35d02e038f48f03cb0dd2a56ace0b (patch)
tree4641fae4757e349cb50097423e85a589ae95a234 /net
parentff4db3653c00cd23104ab773db6d97533e786105 (diff)
downloadchromium_src-b2b8b8313cf35d02e038f48f03cb0dd2a56ace0b.zip
chromium_src-b2b8b8313cf35d02e038f48f03cb0dd2a56ace0b.tar.gz
chromium_src-b2b8b8313cf35d02e038f48f03cb0dd2a56ace0b.tar.bz2
Revert "Clean up dns prefetch code, and also port it."
This reverts commit r9312. Revert "Fix HostResolver crash when MessageLoop is destroyed during" This reverts commit r9317. BUG=5687,6683 TBR=ph Review URL: http://codereview.chromium.org/21133 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9325 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/base/host_resolver.cc24
-rw-r--r--net/base/host_resolver.h7
2 files changed, 8 insertions, 23 deletions
diff --git a/net/base/host_resolver.cc b/net/base/host_resolver.cc
index 7480fdb..d5d97e7 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;
}
diff --git a/net/base/host_resolver.h b/net/base/host_resolver.h
index 6e61eb5..bfae53c 100644
--- a/net/base/host_resolver.h
+++ b/net/base/host_resolver.h
@@ -41,9 +41,10 @@ class HostResolver {
//
// When callback is null, the operation completes synchronously.
//
- // When callback is non-null, the operation will be performed asynchronously.
- // ERR_IO_PENDING is returned if it has been scheduled successfully. Real
- // result code will be passed to the completion callback.
+ // When callback is non-null, ERR_IO_PENDING is returned if the operation
+ // could not be completed synchronously, in which case the result code will
+ // be passed to the callback when available.
+ //
int Resolve(const std::string& hostname, int port,
AddressList* addresses, CompletionCallback* callback);