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..45767bee5fbdedf7bf1a3d234fd8da6d5b5016d7 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::PostThunk(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()->PostThunk( |
+ FROM_HERE, base::Prebind(&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_->PostThunk(FROM_HERE, |
+ base::Prebind(&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::PostThunk( |
+ FROM_HERE, base::Prebind(&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::Thunk<void(void)> reply = |
+ base::Prebind(&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_->PostThunk(FROM_HERE, reply); |
return; |
} |
} |
- // We didn't post, so delete the reply. |
- delete reply; |
} |
// Callback for when DoProbe() completes (runs on origin thread). |