Change AsyncInvoker to store its closure in a scoped_refptr instead of using a raw pointer.

This is just a cosmetic change and does not solve a particular bug.

R=henrika@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/38749004

Cr-Commit-Position: refs/heads/master@{#8194}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8194 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
perkj@webrtc.org
2015-01-29 08:53:45 +00:00
parent a742cb1f37
commit 827d7e806a
3 changed files with 12 additions and 11 deletions

View File

@ -77,8 +77,8 @@ class AsyncInvoker : public MessageHandler {
void AsyncInvoke(Thread* thread,
const FunctorT& functor,
uint32 id = 0) {
AsyncClosure* closure =
new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor);
scoped_refptr<AsyncClosure> closure(
new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor));
DoInvoke(thread, closure, id);
}
@ -89,9 +89,9 @@ class AsyncInvoker : public MessageHandler {
void (HostT::*callback)(ReturnT),
HostT* callback_host,
uint32 id = 0) {
AsyncClosure* closure =
scoped_refptr<AsyncClosure> closure(
new RefCountedObject<NotifyingAsyncClosure<ReturnT, FunctorT, HostT> >(
this, Thread::Current(), functor, callback, callback_host);
this, Thread::Current(), functor, callback, callback_host));
DoInvoke(thread, closure, id);
}
@ -103,9 +103,9 @@ class AsyncInvoker : public MessageHandler {
void (HostT::*callback)(),
HostT* callback_host,
uint32 id = 0) {
AsyncClosure* closure =
scoped_refptr<AsyncClosure> closure(
new RefCountedObject<NotifyingAsyncClosure<void, FunctorT, HostT> >(
this, Thread::Current(), functor, callback, callback_host);
this, Thread::Current(), functor, callback, callback_host));
DoInvoke(thread, closure, id);
}
@ -121,7 +121,8 @@ class AsyncInvoker : public MessageHandler {
private:
virtual void OnMessage(Message* msg);
void DoInvoke(Thread* thread, AsyncClosure* closure, uint32 id);
void DoInvoke(Thread* thread, const scoped_refptr<AsyncClosure>& closure,
uint32 id);
bool destroying_;