Add AsyncInvoker::Clear method to allow canceling pending invocations
Change-Id: I85707c0980cdfb64acbb61ff8b6245e8da509db8 Bug: webrtc:8823 Reviewed-on: https://webrtc-review.googlesource.com/46801 Commit-Queue: Chris Dziemborowicz <chrisdz@google.com> Reviewed-by: Taylor Brandstetter <deadbeef@webrtc.org> Cr-Commit-Position: refs/heads/master@{#21835}
This commit is contained in:

committed by
Commit Bot

parent
dba737066b
commit
c38d320689
@ -67,6 +67,10 @@ void AsyncInvoker::Flush(Thread* thread, uint32_t id /*= MQID_ANY*/) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AsyncInvoker::Clear() {
|
||||||
|
MessageQueueManager::Clear(this);
|
||||||
|
}
|
||||||
|
|
||||||
void AsyncInvoker::DoInvoke(const Location& posted_from,
|
void AsyncInvoker::DoInvoke(const Location& posted_from,
|
||||||
Thread* thread,
|
Thread* thread,
|
||||||
std::unique_ptr<AsyncClosure> closure,
|
std::unique_ptr<AsyncClosure> closure,
|
||||||
|
@ -124,6 +124,11 @@ class AsyncInvoker : public MessageHandler {
|
|||||||
// behavior is desired, call Flush() before destroying this object.
|
// behavior is desired, call Flush() before destroying this object.
|
||||||
void Flush(Thread* thread, uint32_t id = MQID_ANY);
|
void Flush(Thread* thread, uint32_t id = MQID_ANY);
|
||||||
|
|
||||||
|
// Cancels any outstanding calls we own that are pending on any thread, and
|
||||||
|
// which have not yet started to execute. This does not wait for any calls
|
||||||
|
// that have already started executing to complete.
|
||||||
|
void Clear();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void OnMessage(Message* msg) override;
|
void OnMessage(Message* msg) override;
|
||||||
void DoInvoke(const Location& posted_from,
|
void DoInvoke(const Location& posted_from,
|
||||||
|
Reference in New Issue
Block a user