Index: net/base/host_resolver_impl.cc |
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc |
index b53ec6d3ccd5caeba55953ec6c195d117a396b07..e54fa699b747c34be46102526d8510b3804d1642 100644 |
--- a/net/base/host_resolver_impl.cc |
+++ b/net/base/host_resolver_impl.cc |
@@ -15,6 +15,7 @@ |
#include <vector> |
#include "base/basictypes.h" |
+#include "base/prebind.h" |
#include "base/compiler_specific.h" |
#include "base/debug/debugger.h" |
#include "base/debug/stack_trace.h" |
@@ -382,16 +383,16 @@ class HostResolverImpl::Job |
start_time_ = base::TimeTicks::Now(); |
// Dispatch the job to a worker thread. |
- if (!WorkerPool::PostTask(FROM_HERE, |
- NewRunnableMethod(this, &Job::DoLookup), true)) { |
+ if (!WorkerPool::PostClosure(FROM_HERE, |
+ base::Prebind(&Job::DoLookup, this), true)) { |
NOTREACHED(); |
// Since we could be running within Resolve() right now, we can't just |
// call OnLookupComplete(). Instead we must wait until Resolve() has |
// returned (IO_PENDING). |
error_ = ERR_UNEXPECTED; |
- MessageLoop::current()->PostTask( |
- FROM_HERE, NewRunnableMethod(this, &Job::OnLookupComplete)); |
+ MessageLoop::current()->PostClosure( |
+ FROM_HERE, base::Closure(&Job::OnLookupComplete, this)); |
} |
} |
@@ -484,8 +485,8 @@ class HostResolverImpl::Job |
{ |
AutoLock locked(origin_loop_lock_); |
if (origin_loop_) { |
- origin_loop_->PostTask(FROM_HERE, |
- NewRunnableMethod(this, &Job::OnLookupComplete)); |
+ origin_loop_->PostClosure(FROM_HERE, |
+ base::Closure(&Job::OnLookupComplete, this)); |
} |
} |
} |
@@ -650,8 +651,8 @@ class HostResolverImpl::IPv6ProbeJob |
return; |
DCHECK(IsOnOriginThread()); |
const bool kIsSlow = true; |
- WorkerPool::PostTask( |
- FROM_HERE, NewRunnableMethod(this, &IPv6ProbeJob::DoProbe), kIsSlow); |
+ WorkerPool::PostClosure( |
+ FROM_HERE, base::Closure(&IPv6ProbeJob::DoProbe, this), kIsSlow); |
} |
// Cancels the current job. |
@@ -689,21 +690,19 @@ class HostResolverImpl::IPv6ProbeJob |
AddressFamily family = IPv6Supported() ? ADDRESS_FAMILY_UNSPECIFIED |
: ADDRESS_FAMILY_IPV4; |
- Task* reply = NewRunnableMethod(this, &IPv6ProbeJob::OnProbeComplete, |
- family); |
+ base::Closure reply = base::Closure(&IPv6ProbeJob::OnProbeComplete, this, |
+ family); |
// The origin loop could go away while we are trying to post to it, so we |
// need to call its PostTask method inside a lock. See ~HostResolver. |
{ |
AutoLock locked(origin_loop_lock_); |
if (origin_loop_) { |
- origin_loop_->PostTask(FROM_HERE, reply); |
+ origin_loop_->PostClosure(FROM_HERE, reply); |
return; |
} |
} |
- // We didn't post, so delete the reply. |
- delete reply; |
} |
// Callback for when DoProbe() completes (runs on origin thread). |