Index: webrtc/base/asyncinvoker.cc |
diff --git a/webrtc/base/asyncinvoker.cc b/webrtc/base/asyncinvoker.cc |
index 8285d5545b255427e39c42136e932c140600cd80..83a873811e7258a16a982c39609598114ca78055 100644 |
--- a/webrtc/base/asyncinvoker.cc |
+++ b/webrtc/base/asyncinvoker.cc |
@@ -41,7 +41,8 @@ void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) { |
// Run this on |thread| to reduce the number of context switches. |
if (Thread::Current() != thread) { |
- thread->Invoke<void>(Bind(&AsyncInvoker::Flush, this, thread, id)); |
+ thread->Invoke<void>(RTC_FROM_HERE, |
+ Bind(&AsyncInvoker::Flush, this, thread, id)); |
return; |
} |
@@ -49,23 +50,24 @@ void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) { |
thread->Clear(this, id, &removed); |
for (MessageList::iterator it = removed.begin(); it != removed.end(); ++it) { |
// This message was pending on this thread, so run it now. |
- thread->Send(it->phandler, |
- it->message_id, |
- it->pdata); |
+ thread->Send(it->posted_from, it->phandler, it->message_id, it->pdata); |
} |
} |
-void AsyncInvoker::DoInvoke(Thread* thread, |
+void AsyncInvoker::DoInvoke(const Location& posted_from, |
+ Thread* thread, |
const scoped_refptr<AsyncClosure>& closure, |
uint32_t id) { |
if (destroying_) { |
LOG(LS_WARNING) << "Tried to invoke while destroying the invoker."; |
return; |
} |
- thread->Post(this, id, new ScopedRefMessageData<AsyncClosure>(closure)); |
+ thread->Post(posted_from, this, id, |
+ new ScopedRefMessageData<AsyncClosure>(closure)); |
} |
-void AsyncInvoker::DoInvokeDelayed(Thread* thread, |
+void AsyncInvoker::DoInvokeDelayed(const Location& posted_from, |
+ Thread* thread, |
const scoped_refptr<AsyncClosure>& closure, |
uint32_t delay_ms, |
uint32_t id) { |
@@ -73,7 +75,7 @@ void AsyncInvoker::DoInvokeDelayed(Thread* thread, |
LOG(LS_WARNING) << "Tried to invoke while destroying the invoker."; |
return; |
} |
- thread->PostDelayed(delay_ms, this, id, |
+ thread->PostDelayed(posted_from, delay_ms, this, id, |
new ScopedRefMessageData<AsyncClosure>(closure)); |
} |
@@ -100,9 +102,13 @@ void GuardedAsyncInvoker::ThreadDestroyed() { |
thread_ = nullptr; |
} |
-NotifyingAsyncClosureBase::NotifyingAsyncClosureBase(AsyncInvoker* invoker, |
- Thread* calling_thread) |
- : invoker_(invoker), calling_thread_(calling_thread) { |
+NotifyingAsyncClosureBase::NotifyingAsyncClosureBase( |
+ AsyncInvoker* invoker, |
+ const Location& callback_posted_from, |
+ Thread* calling_thread) |
+ : invoker_(invoker), |
+ callback_posted_from_(callback_posted_from), |
+ calling_thread_(calling_thread) { |
calling_thread->SignalQueueDestroyed.connect( |
this, &NotifyingAsyncClosureBase::CancelCallback); |
invoker->SignalInvokerDestroyed.connect( |
@@ -116,7 +122,8 @@ NotifyingAsyncClosureBase::~NotifyingAsyncClosureBase() { |
void NotifyingAsyncClosureBase::TriggerCallback() { |
CritScope cs(&crit_); |
if (!CallbackCanceled() && !callback_.empty()) { |
- invoker_->AsyncInvoke<void>(calling_thread_, callback_); |
+ invoker_->AsyncInvoke<void>(callback_posted_from_, calling_thread_, |
+ callback_); |
} |
} |