| Index: webrtc/base/asyncinvoker.cc
|
| diff --git a/webrtc/base/asyncinvoker.cc b/webrtc/base/asyncinvoker.cc
|
| index 83a873811e7258a16a982c39609598114ca78055..77b63a4e66a6f82de6e9ac47c0d1d7d8db00a317 100644
|
| --- a/webrtc/base/asyncinvoker.cc
|
| +++ b/webrtc/base/asyncinvoker.cc
|
| @@ -26,14 +26,11 @@ AsyncInvoker::~AsyncInvoker() {
|
|
|
| void AsyncInvoker::OnMessage(Message* msg) {
|
| // Get the AsyncClosure shared ptr from this message's data.
|
| - ScopedRefMessageData<AsyncClosure>* data =
|
| - static_cast<ScopedRefMessageData<AsyncClosure>*>(msg->pdata);
|
| - scoped_refptr<AsyncClosure> closure = data->data();
|
| - delete msg->pdata;
|
| - msg->pdata = NULL;
|
| -
|
| + ScopedMessageData<AsyncClosure>* data =
|
| + static_cast<ScopedMessageData<AsyncClosure>*>(msg->pdata);
|
| // Execute the closure and trigger the return message if needed.
|
| - closure->Execute();
|
| + data->inner_data().Execute();
|
| + delete data;
|
| }
|
|
|
| void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) {
|
| @@ -56,19 +53,19 @@ void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) {
|
|
|
| void AsyncInvoker::DoInvoke(const Location& posted_from,
|
| Thread* thread,
|
| - const scoped_refptr<AsyncClosure>& closure,
|
| + std::unique_ptr<AsyncClosure> closure,
|
| uint32_t id) {
|
| if (destroying_) {
|
| LOG(LS_WARNING) << "Tried to invoke while destroying the invoker.";
|
| return;
|
| }
|
| thread->Post(posted_from, this, id,
|
| - new ScopedRefMessageData<AsyncClosure>(closure));
|
| + new ScopedMessageData<AsyncClosure>(std::move(closure)));
|
| }
|
|
|
| void AsyncInvoker::DoInvokeDelayed(const Location& posted_from,
|
| Thread* thread,
|
| - const scoped_refptr<AsyncClosure>& closure,
|
| + std::unique_ptr<AsyncClosure> closure,
|
| uint32_t delay_ms,
|
| uint32_t id) {
|
| if (destroying_) {
|
| @@ -76,7 +73,7 @@ void AsyncInvoker::DoInvokeDelayed(const Location& posted_from,
|
| return;
|
| }
|
| thread->PostDelayed(posted_from, delay_ms, this, id,
|
| - new ScopedRefMessageData<AsyncClosure>(closure));
|
| + new ScopedMessageData<AsyncClosure>(std::move(closure)));
|
| }
|
|
|
| GuardedAsyncInvoker::GuardedAsyncInvoker() : thread_(Thread::Current()) {
|
|
|