Remove workaround in AutoSocketServerThread that isn't needed anymore.

Cleanup steps for the Connection class have changed as of:
https://webrtc-review.googlesource.com/c/src/+/249941

However, it turns out that the PortTest suite still needs it, so the
workaround has migrated to there.

Bug: none
Change-Id: Ia68f47b6c65b3a8fd5e8c04d70a43d15ba1a6422
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/250223
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#35894}
This commit is contained in:
Tommi
2022-02-02 17:30:59 +01:00
committed by WebRTC LUCI CQ
parent 3fe4b10730
commit 44156fa024
2 changed files with 7 additions and 5 deletions

View File

@ -415,6 +415,13 @@ class PortTest : public ::testing::Test, public sigslot::has_slots<> {
role_conflict_(false),
ports_destroyed_(0) {}
~PortTest() {
// Workaround for tests that trigger async destruction of objects that we
// need to give an opportunity here to run, before proceeding with other
// teardown.
rtc::Thread::Current()->ProcessMessages(0);
}
protected:
std::string password() { return password_; }

View File

@ -1236,11 +1236,6 @@ AutoSocketServerThread::AutoSocketServerThread(SocketServer* ss)
AutoSocketServerThread::~AutoSocketServerThread() {
RTC_DCHECK(ThreadManager::Instance()->CurrentThread() == this);
// Some tests post destroy messages to this thread. To avoid memory
// leaks, we have to process those messages. In particular
// P2PTransportChannelPingTest, relying on the message posted in
// cricket::Connection::Destroy.
ProcessMessages(0);
// Stop and destroy the thread before clearing it as the current thread.
// Sometimes there are messages left in the Thread that will be
// destroyed by DoDestroy, and sometimes the destructors of the message and/or