Remove the AsyncInvoker alias.
This emphasizes the "hint" to potential external users that the
class has been deprecated.
Bug: webrtc:12339
Change-Id: Iab83481af69a505059297cce959f02b5ab649f2f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/237805
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Tommi <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35368}
diff --git a/media/sctp/usrsctp_transport.cc b/media/sctp/usrsctp_transport.cc
index 40ce840..4babf11 100644
--- a/media/sctp/usrsctp_transport.cc
+++ b/media/sctp/usrsctp_transport.cc
@@ -1172,8 +1172,8 @@
// packet will have called connect, and a connection will be established.
if (sock_) {
// Pass received packet to SCTP stack. Once processed by usrsctp, the data
- // will be will be given to the global OnSctpInboundData, and then,
- // marshalled by the AsyncInvoker.
+ // will be will be given to the global OnSctpInboundPacket callback and
+ // posted to the transport thread.
VerboseLogPacket(data, len, SCTP_DUMP_INBOUND);
usrsctp_conninput(reinterpret_cast<void*>(id_), data, len, 0);
} else {
diff --git a/rtc_base/async_invoker.h b/rtc_base/async_invoker.h
index 20b24f3..8a54159 100644
--- a/rtc_base/async_invoker.h
+++ b/rtc_base/async_invoker.h
@@ -26,6 +26,8 @@
namespace rtc {
+// DEPRECATED - do not use.
+//
// Invokes function objects (aka functors) asynchronously on a Thread, and
// owns the lifetime of calls (ie, when this object is destroyed, calls in
// flight are cancelled). AsyncInvoker can optionally execute a user-specified
@@ -153,10 +155,9 @@
// future.
std::atomic<int> pending_invocations_;
- // Reference counted so that if the AsyncInvoker destructor finishes before
- // an AsyncClosure's destructor that's about to call
- // "invocation_complete_->Set()", it's not dereferenced after being
- // destroyed.
+ // Reference counted so that if the destructor finishes before an
+ // AsyncClosure's destructor that's about to call
+ // "invocation_complete_->Set()", it's not dereferenced after being destroyed.
rtc::Ref<Event>::Ptr invocation_complete_;
// This flag is used to ensure that if an application AsyncInvokes tasks that
@@ -169,9 +170,6 @@
RTC_DISALLOW_COPY_AND_ASSIGN(DEPRECATED_AsyncInvoker);
};
-using AsyncInvoker ABSL_DEPRECATED("bugs.webrtc.org/12339") =
- DEPRECATED_AsyncInvoker;
-
} // namespace rtc
#endif // RTC_BASE_ASYNC_INVOKER_H_
diff --git a/rtc_base/async_invoker_inl.h b/rtc_base/async_invoker_inl.h
index 9fb3287..c2b6413 100644
--- a/rtc_base/async_invoker_inl.h
+++ b/rtc_base/async_invoker_inl.h
@@ -23,7 +23,7 @@
class DEPRECATED_AsyncInvoker;
-// Helper class for AsyncInvoker. Runs a task and triggers a callback
+// Helper class for DEPRECATED_AsyncInvoker. Runs a task and triggers a callback
// on the calling thread if necessary.
class AsyncClosure {
public:
diff --git a/rtc_base/thread_unittest.cc b/rtc_base/thread_unittest.cc
index 430db3d..87c87e6 100644
--- a/rtc_base/thread_unittest.cc
+++ b/rtc_base/thread_unittest.cc
@@ -742,7 +742,7 @@
new ScopedRefMessageData<RefCountedHandler>(inner_handler));
}
-class AsyncInvokeTest : public ::testing::Test {
+class DEPRECATED_AsyncInvokeTest : public ::testing::Test {
public:
void IntCallback(int value) {
EXPECT_EQ(expected_thread_, Thread::Current());
@@ -754,13 +754,13 @@
protected:
enum { kWaitTimeout = 1000 };
- AsyncInvokeTest() : int_value_(0), expected_thread_(nullptr) {}
+ DEPRECATED_AsyncInvokeTest() : int_value_(0), expected_thread_(nullptr) {}
int int_value_;
Thread* expected_thread_;
};
-TEST_F(AsyncInvokeTest, FireAndForget) {
+TEST_F(DEPRECATED_AsyncInvokeTest, FireAndForget) {
DEPRECATED_AsyncInvoker invoker;
// Create and start the thread.
auto thread = Thread::CreateWithSocketServer();
@@ -772,7 +772,7 @@
thread->Stop();
}
-TEST_F(AsyncInvokeTest, NonCopyableFunctor) {
+TEST_F(DEPRECATED_AsyncInvokeTest, NonCopyableFunctor) {
DEPRECATED_AsyncInvoker invoker;
// Create and start the thread.
auto thread = Thread::CreateWithSocketServer();
@@ -784,7 +784,7 @@
thread->Stop();
}
-TEST_F(AsyncInvokeTest, KillInvokerDuringExecute) {
+TEST_F(DEPRECATED_AsyncInvokeTest, KillInvokerDuringExecute) {
// Use these events to get in a state where the functor is in the middle of
// executing, and then to wait for it to finish, ensuring the "EXPECT_FALSE"
// is run.
@@ -821,10 +821,10 @@
}
// Variant of the above test where the async-invoked task calls AsyncInvoke
-// *again*, for the thread on which the AsyncInvoker is currently being
-// destroyed. This shouldn't deadlock or crash; this second invocation should
-// just be ignored.
-TEST_F(AsyncInvokeTest, KillInvokerDuringExecuteWithReentrantInvoke) {
+// *again*, for the thread on which the invoker is currently being destroyed.
+// This shouldn't deadlock or crash. The second invocation should be ignored.
+TEST_F(DEPRECATED_AsyncInvokeTest,
+ KillInvokerDuringExecuteWithReentrantInvoke) {
Event functor_started;
// Flag used to verify that the recursively invoked task never actually runs.
bool reentrant_functor_run = false;
@@ -851,7 +851,7 @@
EXPECT_FALSE(reentrant_functor_run);
}
-TEST_F(AsyncInvokeTest, Flush) {
+TEST_F(DEPRECATED_AsyncInvokeTest, Flush) {
DEPRECATED_AsyncInvoker invoker;
AtomicBool flag1;
AtomicBool flag2;
@@ -867,7 +867,7 @@
EXPECT_TRUE(flag2.get());
}
-TEST_F(AsyncInvokeTest, FlushWithIds) {
+TEST_F(DEPRECATED_AsyncInvokeTest, FlushWithIds) {
DEPRECATED_AsyncInvoker invoker;
AtomicBool flag1;
AtomicBool flag2;