Delete Call dependency on ProcessThread as unused
Last usage or ProcessThread was removed in https://webrtc-review.googlesource.com/c/src/+/265921 Bug: webrtc:7219 Change-Id: Ia46d9e2530cd0dbf56a5c0ca6e1bf0936fd62672 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/266363 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#37287}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
bfd973f212
commit
80b7c6befd
@ -31,7 +31,6 @@
|
||||
#include "call/audio_state.h"
|
||||
#include "modules/audio_device/include/mock_audio_device.h"
|
||||
#include "modules/audio_processing/include/mock_audio_processing.h"
|
||||
#include "modules/include/module.h"
|
||||
#include "modules/rtp_rtcp/source/rtp_rtcp_interface.h"
|
||||
#include "test/fake_encoder.h"
|
||||
#include "test/gtest.h"
|
||||
@ -476,59 +475,4 @@ TEST(CallTest, AddAdaptationResourceBeforeCreatingVideoSendStream) {
|
||||
call->DestroyVideoSendStream(stream2);
|
||||
}
|
||||
|
||||
TEST(CallTest, SharedModuleThread) {
|
||||
class SharedModuleThreadUser : public Module {
|
||||
public:
|
||||
SharedModuleThreadUser(ProcessThread* expected_thread,
|
||||
rtc::scoped_refptr<SharedModuleThread> thread)
|
||||
: expected_thread_(expected_thread), thread_(std::move(thread)) {
|
||||
thread_->EnsureStarted();
|
||||
thread_->process_thread()->RegisterModule(this, RTC_FROM_HERE);
|
||||
}
|
||||
|
||||
~SharedModuleThreadUser() override {
|
||||
thread_->process_thread()->DeRegisterModule(this);
|
||||
EXPECT_TRUE(thread_was_checked_);
|
||||
}
|
||||
|
||||
private:
|
||||
int64_t TimeUntilNextProcess() override { return 1000; }
|
||||
void Process() override {}
|
||||
void ProcessThreadAttached(ProcessThread* process_thread) override {
|
||||
if (!process_thread) {
|
||||
// Being detached.
|
||||
return;
|
||||
}
|
||||
EXPECT_EQ(process_thread, expected_thread_);
|
||||
thread_was_checked_ = true;
|
||||
}
|
||||
|
||||
bool thread_was_checked_ = false;
|
||||
ProcessThread* const expected_thread_;
|
||||
rtc::scoped_refptr<SharedModuleThread> thread_;
|
||||
};
|
||||
|
||||
// Create our test instance and pass a lambda to it that gets executed when
|
||||
// the reference count goes back to 1 - meaning `shared` again is the only
|
||||
// reference, which means we can free the variable and deallocate the thread.
|
||||
rtc::scoped_refptr<SharedModuleThread> shared;
|
||||
shared =
|
||||
SharedModuleThread::Create(ProcessThread::Create("MySharedProcessThread"),
|
||||
[&shared]() { shared = nullptr; });
|
||||
ProcessThread* process_thread = shared->process_thread();
|
||||
|
||||
ASSERT_TRUE(shared.get());
|
||||
|
||||
{
|
||||
// Create a couple of users of the thread.
|
||||
// These instances are in a separate scope to trigger the callback to our
|
||||
// lambda, which will run when these go out of scope.
|
||||
SharedModuleThreadUser user1(process_thread, shared);
|
||||
SharedModuleThreadUser user2(process_thread, shared);
|
||||
}
|
||||
|
||||
// The thread should now have been stopped and freed.
|
||||
EXPECT_FALSE(shared);
|
||||
}
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user