Remove DEPRECATED_AsyncInvoker::Flush.
The method is not used so can be safely deleted before the full (and eventual) removal of the implementation. Bug: webrtc:12339 Change-Id: I7726313c46562041f670c3baec2db955de0b4298 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/238141 Auto-Submit: Tommi <tommi@webrtc.org> Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35375}
This commit is contained in:
parent
6002b15cd1
commit
0a7a8e0aba
@ -46,28 +46,6 @@ void DEPRECATED_AsyncInvoker::OnMessage(Message* msg) {
|
||||
delete data;
|
||||
}
|
||||
|
||||
void DEPRECATED_AsyncInvoker::Flush(Thread* thread,
|
||||
uint32_t id /*= MQID_ANY*/) {
|
||||
// If the destructor is waiting for invocations to finish, don't start
|
||||
// running even more tasks.
|
||||
if (destroying_.load(std::memory_order_relaxed))
|
||||
return;
|
||||
|
||||
// Run this on `thread` to reduce the number of context switches.
|
||||
if (Thread::Current() != thread) {
|
||||
thread->Invoke<void>(RTC_FROM_HERE,
|
||||
[this, thread, id] { Flush(thread, id); });
|
||||
return;
|
||||
}
|
||||
|
||||
MessageList removed;
|
||||
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->posted_from, it->phandler, it->message_id, it->pdata);
|
||||
}
|
||||
}
|
||||
|
||||
void DEPRECATED_AsyncInvoker::Clear() {
|
||||
ThreadManager::Clear(this);
|
||||
}
|
||||
|
||||
@ -121,13 +121,6 @@ class DEPRECATED_AsyncInvoker : public MessageHandlerAutoCleanup {
|
||||
DoInvokeDelayed(posted_from, thread, std::move(closure), delay_ms, id);
|
||||
}
|
||||
|
||||
// Synchronously execute on `thread` all outstanding calls we own
|
||||
// that are pending on `thread`, and wait for calls to complete
|
||||
// before returning. Optionally filter by message id.
|
||||
// The destructor will not wait for outstanding calls, so if that
|
||||
// behavior is desired, call Flush() before destroying this object.
|
||||
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.
|
||||
|
||||
@ -851,44 +851,6 @@ TEST_F(DEPRECATED_AsyncInvokeTest,
|
||||
EXPECT_FALSE(reentrant_functor_run);
|
||||
}
|
||||
|
||||
TEST_F(DEPRECATED_AsyncInvokeTest, Flush) {
|
||||
DEPRECATED_AsyncInvoker invoker;
|
||||
AtomicBool flag1;
|
||||
AtomicBool flag2;
|
||||
// Queue two async calls to the current thread.
|
||||
invoker.AsyncInvoke<void>(RTC_FROM_HERE, Thread::Current(), FunctorB(&flag1));
|
||||
invoker.AsyncInvoke<void>(RTC_FROM_HERE, Thread::Current(), FunctorB(&flag2));
|
||||
// Because we haven't pumped messages, these should not have run yet.
|
||||
EXPECT_FALSE(flag1.get());
|
||||
EXPECT_FALSE(flag2.get());
|
||||
// Force them to run now.
|
||||
invoker.Flush(Thread::Current());
|
||||
EXPECT_TRUE(flag1.get());
|
||||
EXPECT_TRUE(flag2.get());
|
||||
}
|
||||
|
||||
TEST_F(DEPRECATED_AsyncInvokeTest, FlushWithIds) {
|
||||
DEPRECATED_AsyncInvoker invoker;
|
||||
AtomicBool flag1;
|
||||
AtomicBool flag2;
|
||||
// Queue two async calls to the current thread, one with a message id.
|
||||
invoker.AsyncInvoke<void>(RTC_FROM_HERE, Thread::Current(), FunctorB(&flag1),
|
||||
5);
|
||||
invoker.AsyncInvoke<void>(RTC_FROM_HERE, Thread::Current(), FunctorB(&flag2));
|
||||
// Because we haven't pumped messages, these should not have run yet.
|
||||
EXPECT_FALSE(flag1.get());
|
||||
EXPECT_FALSE(flag2.get());
|
||||
// Execute pending calls with id == 5.
|
||||
invoker.Flush(Thread::Current(), 5);
|
||||
EXPECT_TRUE(flag1.get());
|
||||
EXPECT_FALSE(flag2.get());
|
||||
flag1 = false;
|
||||
// Execute all pending calls. The id == 5 call should not execute again.
|
||||
invoker.Flush(Thread::Current());
|
||||
EXPECT_FALSE(flag1.get());
|
||||
EXPECT_TRUE(flag2.get());
|
||||
}
|
||||
|
||||
void WaitAndSetEvent(Event* wait_event, Event* set_event) {
|
||||
wait_event->Wait(Event::kForever);
|
||||
set_event->Set();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user