Remove all sigslot references from libwebrtc

Also change its visibility rules so that it cannot be reintroduced,
but is still visible to downstream users.

Bug: webrtc:42222066
Change-Id: I3235e84785eb4535696e9e6c8cfc24965b02c75d
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/427560
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#46303}
This commit is contained in:
Harald Alvestrand 2025-11-24 21:58:55 +00:00 committed by WebRTC LUCI CQ
parent 131cd6104a
commit 336ff92176
29 changed files with 34 additions and 352 deletions

View File

@ -665,7 +665,6 @@ if (rtc_include_tests && !build_with_chromium) {
"rtc_base:rtc_numerics_unittests",
"rtc_base:rtc_operations_chain_unittests",
"rtc_base:rtc_task_queue_unittests",
"rtc_base:sigslot_trampoline_unittest",
"rtc_base:sigslot_unittest",
"rtc_base:task_queue_stdlib_unittest",
"rtc_base:untyped_function_unittest",

View File

@ -721,7 +721,6 @@ if (is_linux || is_chromeos || is_win) {
"../rtc_base:ssl_adapter",
"../rtc_base:stringutils",
"../rtc_base:threading",
"../rtc_base/third_party/sigslot",
"../system_wrappers",
"../test:frame_generator_capturer",
"../test:platform_video_capturer",

View File

@ -125,7 +125,6 @@ rtc_library("rtc_media_base") {
"../rtc_base/system:file_wrapper",
"../rtc_base/system:no_unique_address",
"../rtc_base/system:rtc_export",
"../rtc_base/third_party/sigslot",
"../video/config:encoder_config",
"//third_party/abseil-cpp/absl/base:core_headers",
]
@ -885,7 +884,6 @@ if (rtc_include_tests) {
"../rtc_base/network:sent_packet",
"../rtc_base/synchronization:mutex",
"../rtc_base/system:file_wrapper",
"../rtc_base/third_party/sigslot",
"../test:create_test_field_trials",
"../test:test_support",
"../video/config:encoder_config",

View File

@ -827,7 +827,6 @@ rtc_library("tcp_port") {
"../rtc_base/containers:flat_map",
"../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"../rtc_base/third_party/sigslot",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings:string_view",
@ -919,7 +918,6 @@ rtc_library("turn_port") {
"../rtc_base:stringutils",
"../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"../rtc_base/third_party/sigslot",
"../system_wrappers:metrics",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/memory",
@ -1150,7 +1148,6 @@ if (rtc_include_tests) {
"../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"../rtc_base/synchronization:mutex",
"../rtc_base/third_party/sigslot",
"../test:test_support",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/memory",
@ -1291,7 +1288,6 @@ if (rtc_include_tests) {
"../rtc_base:timeutils",
"../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"../rtc_base/third_party/sigslot",
"../system_wrappers:metrics",
"../test:create_test_environment",
"../test:create_test_field_trials",

View File

@ -91,7 +91,6 @@
#include "rtc_base/socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/socket_server.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
#include "rtc_base/virtual_socket_server.h"
@ -3589,8 +3588,7 @@ TEST_F(P2PTransportChannelMultihomedTest, StunDictionaryPerformsSync) {
// A collection of tests which tests a single P2PTransportChannel by sending
// pings.
class P2PTransportChannelPingTest : public ::testing::Test,
public sigslot::has_slots<> {
class P2PTransportChannelPingTest : public ::testing::Test {
public:
P2PTransportChannelPingTest()
: vss_(std::make_unique<VirtualSocketServer>()),

View File

@ -55,7 +55,6 @@
#include "rtc_base/socket_address.h"
#include "rtc_base/socket_factory.h"
#include "rtc_base/socket_server.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h"
#include "system_wrappers/include/metrics.h"
@ -139,7 +138,7 @@ class FakeMdnsResponderProvider : public webrtc::MdnsResponderProvider {
// Base class for tests connecting a StunPort to a fake STUN server
// (webrtc::StunServer).
class StunPortTestBase : public ::testing::Test, public sigslot::has_slots<> {
class StunPortTestBase : public ::testing::Test {
public:
StunPortTestBase()
: StunPortTestBase(kPrivateIP.ipaddr(),

View File

@ -30,11 +30,11 @@
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/checks.h"
#include "rtc_base/containers/flat_map.h"
#include "rtc_base/net_helper.h"
#include "rtc_base/network/received_packet.h"
#include "rtc_base/network/sent_packet.h"
#include "rtc_base/socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/weak_ptr.h"
namespace webrtc {
@ -124,7 +124,7 @@ class TCPPort : public Port {
friend class TCPConnection;
};
class TCPConnection : public Connection, public sigslot::has_slots<> {
class TCPConnection : public Connection {
public:
// Connection is outgoing unless socket is specified
TCPConnection(const Environment& env,

View File

@ -56,7 +56,6 @@
#include "rtc_base/ssl_certificate.h"
#include "rtc_base/string_encode.h"
#include "rtc_base/strings/string_builder.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "system_wrappers/include/metrics.h"
namespace webrtc {
@ -166,11 +165,11 @@ class TurnChannelBindRequest : public StunRequest {
// Manages a "connection" to a remote destination. We will attempt to bring up
// a channel for this remote destination to reduce the overhead of sending data.
class TurnEntry : public sigslot::has_slots<> {
class TurnEntry {
public:
enum BindState { STATE_UNBOUND, STATE_BINDING, STATE_BOUND };
TurnEntry(TurnPort* port, Connection* conn, int channel_id);
~TurnEntry() override;
~TurnEntry();
TurnPort* port() { return port_; }

View File

@ -59,7 +59,6 @@
#include "rtc_base/network/received_packet.h"
#include "rtc_base/socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h"
#include "system_wrappers/include/metrics.h"
@ -211,9 +210,7 @@ class TestConnectionWrapper {
// Note: This test uses a fake clock with a simulated network round trip
// (between local port and TURN server) of kSimulatedRtt.
class TurnPortTest : public ::testing::Test,
public TurnPort::CallbacksForTest,
public sigslot::has_slots<> {
class TurnPortTest : public ::testing::Test, public TurnPort::CallbacksForTest {
public:
TurnPortTest()
: ss_(new TurnPortTestVirtualSocketServer()),

View File

@ -53,7 +53,6 @@
#include "rtc_base/network_constants.h"
#include "rtc_base/socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h"
#include "system_wrappers/include/metrics.h"
@ -154,8 +153,7 @@ void CheckStunKeepaliveIntervalOfAllReadyPorts(
namespace webrtc {
class BasicPortAllocatorTestBase : public ::testing::Test,
public sigslot::has_slots<> {
class BasicPortAllocatorTestBase : public ::testing::Test {
public:
BasicPortAllocatorTestBase()
: vss_(new VirtualSocketServer()),

View File

@ -50,7 +50,6 @@
#include "rtc_base/ssl_fingerprint.h"
#include "rtc_base/ssl_identity.h"
#include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h"
#include "test/create_test_field_trials.h"
@ -79,8 +78,7 @@ class DtlsIceIntegrationTest : public ::testing::TestWithParam<std::tuple<
SSLProtocolVersion,
/* 3 client_dtls_is_ice_controlling= */ bool,
/* 4 client_pqc= */ bool,
/* 5 server_pqc= */ bool>>,
public sigslot::has_slots<> {
/* 5 server_pqc= */ bool>> {
public:
void CandidateC2S(IceTransportInternal*, const Candidate& c) {
server_thread()->PostTask(

View File

@ -32,7 +32,6 @@
#include "rtc_base/socket_address.h"
#include "rtc_base/socket_factory.h"
#include "rtc_base/socket_server.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h"
@ -88,7 +87,7 @@ size_t UnpackAddressFromNAT(ArrayView<const uint8_t> buf,
}
// NATSocket
class NATSocket : public Socket, public sigslot::has_slots<> {
class NATSocket : public Socket {
public:
explicit NATSocket(NATInternalSocketFactory* sf, int family, int type)
: sf_(sf),

View File

@ -2299,7 +2299,6 @@ if (rtc_include_tests && !build_with_chromium) {
"../rtc_base/containers:flat_set",
"../rtc_base/network:received_packet",
"../rtc_base/network:sent_packet",
"../rtc_base/third_party/sigslot",
"../system_wrappers:metrics",
"../test:create_test_environment",
"../test:create_test_field_trials",

View File

@ -40,7 +40,6 @@
#include "rtc_base/rtc_certificate.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/ssl_fingerprint.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "test/gmock.h"
#include "test/gtest.h"
@ -64,12 +63,11 @@ bool IsRtpOrRtcpPacket(uint8_t first_byte) {
return (first_byte & 0xc0) == 0x80;
}
class DatagramConnectionTest : public ::testing::Test,
public sigslot::has_slots<> {
class DatagramConnectionTest : public ::testing::Test {
public:
DatagramConnectionTest() : env_(CreateEnvironment()) {}
~DatagramConnectionTest() override {
~DatagramConnectionTest() {
conn1_->Terminate([] {});
conn2_->Terminate([] {});
}

View File

@ -64,7 +64,6 @@
#include "rtc_base/ssl_identity.h"
#include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/task_queue_for_test.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "system_wrappers/include/metrics.h"
#include "test/create_test_field_trials.h"
@ -117,8 +116,7 @@ class FakeDtlsTransportFactory : public DtlsTransportFactory {
};
class JsepTransportControllerTest : public JsepTransportController::Observer,
public ::testing::Test,
public sigslot::has_slots<> {
public ::testing::Test {
public:
JsepTransportControllerTest()
: env_(CreateEnvironment(&field_trials_)),

View File

@ -1029,7 +1029,6 @@ rtc_library("threading") {
"synchronization:mutex",
"system:no_unique_address",
"system:rtc_export",
"third_party/sigslot",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/cleanup",
@ -1254,26 +1253,6 @@ rtc_library("network") {
}
}
rtc_source_set("sigslot_trampoline") {
sources = [ "sigslot_trampoline.h" ]
deps = [
":callback_list",
"third_party/sigslot",
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
rtc_library("sigslot_trampoline_unittest") {
testonly = true
sources = [ "sigslot_trampoline_unittest.cc" ]
deps = [
":sigslot_trampoline",
"../test:test_support",
"third_party/sigslot",
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}
rtc_library("socket_address_pair") {
sources = [
"socket_address_pair.cc",
@ -1450,7 +1429,6 @@ if (rtc_include_tests) {
":socket",
"../test:create_test_environment",
"../test:test_support",
"third_party/sigslot",
]
}
}
@ -1773,7 +1751,6 @@ rtc_library("testclient") {
"../test:wait_until",
"network:received_packet",
"synchronization:mutex",
"third_party/sigslot",
]
}
@ -1838,7 +1815,6 @@ rtc_library("rtc_base_tests_utils") {
":network",
":network_constants",
":rtc_event",
":sigslot_trampoline",
":socket",
":socket_adapters",
":socket_address",
@ -1866,7 +1842,6 @@ rtc_library("rtc_base_tests_utils") {
"memory:less_unique_ptr",
"network:received_packet",
"synchronization:mutex",
"third_party/sigslot",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/functional:any_invocable",
@ -2384,7 +2359,6 @@ if (rtc_include_tests) {
"memory:fifo_buffer",
"network:received_packet",
"synchronization:mutex",
"third_party/sigslot",
"//testing/gtest",
"//third_party/abseil-cpp/absl/algorithm:container",
"//third_party/abseil-cpp/absl/functional:any_invocable",

View File

@ -16,7 +16,6 @@
#include "rtc_base/async_packet_socket.h"
#include "rtc_base/net_helpers.h"
#include "rtc_base/socket.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/virtual_socket_server.h"
#include "test/create_test_environment.h"
#include "test/gmock.h"
@ -27,7 +26,7 @@ namespace {
using ::testing::NotNull;
struct AsyncTCPSocketObserver : public sigslot::has_slots<> {
struct AsyncTCPSocketObserver {
void OnReadyToSend(AsyncPacketSocket* socket) { ready_to_send = true; }
bool ready_to_send = false;

View File

@ -37,7 +37,6 @@
#include "rtc_base/network_monitor_factory.h"
#include "rtc_base/physical_socket_server.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "test/create_test_field_trials.h"
#include "test/gmock.h"
@ -166,7 +165,7 @@ std::vector<const Network*> CopyNetworkPointers(
} // namespace
class NetworkTest : public ::testing::Test, public sigslot::has_slots<> {
class NetworkTest : public ::testing::Test {
public:
void OnNetworksChanged() { callback_called_ = true; }

View File

@ -27,7 +27,6 @@
#include "rtc_base/socket_address.h"
#include "rtc_base/ssl_certificate.h"
#include "rtc_base/ssl_stream_adapter.h" // IWYU pragma: keep
#include "rtc_base/third_party/sigslot/sigslot.h" // IWYU pragma: keep
#include "rtc_base/thread.h"
#include "test/gmock.h"
#include "test/gtest.h"

View File

@ -20,7 +20,6 @@
#include "rtc_base/net_helpers.h"
#include "rtc_base/socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#if defined(WEBRTC_POSIX)
#if defined(WEBRTC_LINUX)
@ -162,7 +161,7 @@ class RTC_EXPORT PhysicalSocketServer : public SocketServer {
bool waiting_ = false;
};
class PhysicalSocket : public Socket, public sigslot::has_slots<> {
class PhysicalSocket : public Socket {
public:
PhysicalSocket(PhysicalSocketServer* ss, SOCKET s = INVALID_SOCKET);
~PhysicalSocket() override;

View File

@ -1,173 +0,0 @@
/*
* Copyright 2025 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_SIGSLOT_TRAMPOLINE_H_
#define RTC_BASE_SIGSLOT_TRAMPOLINE_H_
#include <utility>
#include "absl/functional/any_invocable.h"
#include "rtc_base/callback_list.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
namespace webrtc {
// A template to simplify the replacement of sigslot::Signal with a
// CallbackList.
// THIS IS A TEMPORARY OBJECT:
// Once all callers have converted to Subscribe* and Notify*, the signal
// and the trampoline can be replaced with a CallbackList, or, for the case
// where only one listener can ever exist, a simple callback.
// Usage, for class MyClass and signal SignalMyNamedEvent:
// class MyClass {
// MyClass()
// : my_named_event_trampoline_(this) {}
// // existing:
// sigslot::signal0<> SignalMyNamedEvent;
// // new, this is what we want callers to use instead
// void NotifyMyNamedEvent() { SignalMyNamedEvent(); }
// void SubscribeMyNamedEvent(absl::AnyInvocable<void()> callback) {
// my_named_event_trampoline_.Subscribe(std::move(callback));
// }
// private:
// SignalTrampoline<MyClass, &MyClass::SignalMyNamedEvent>
// my_named_event_trampoline_;
// }
//
// At caller, replace:
// my_class_object.SignalMyNamedEvent.connect(target, function)
// with:
// my_class_object.SubscribeMyNamedEvent([target]{ target.function(); }
// Note that the SubscribeMyNamedEvent will NOT guarantee that the target
// continues to exist; if there is any doubt about that, use a SafeInvocable:
// my_class_object.SubscibeMyNamedEvent(
// SafeInvocable(target.safety_flag_.flag(),
// [target] { target.function(); }
// WHEN REMOVING THE SIGNAL
// Make a CL that will:
// - Delete the SignalMyNamedEvent signal
// - Change my_named_event_trampoline_ to my_named_event_callbacks,
// of type CallbackList<function arguments>
// - Change SubscribeMyNamedEvent to call my_named_event_callbacks.AddReceiver
// - Change NotifyMyNamedEvent to call my_named_event_callbacks_.Send
// - If UnsubscribeMyNamedEvent exists, change that also.
// - Delete the initialization of my_named_event_trampoline_ from the
// relevant constructor.
// Sending this through the bots will flush out remaining references to
// SignalMyNamedEvent.
namespace internal {
template <typename MemberPtrT>
struct member_pointer_traits;
// Used to find the type of ClassT::Member
template <typename ClassT, typename MemberT>
struct member_pointer_traits<MemberT ClassT::*> {
using member_type = MemberT;
};
template <typename SignalT>
class SignalTrampolineBase;
template <typename... Args>
class SignalTrampolineBase<sigslot::signal<Args...>>
: public sigslot::has_slots<> {
public:
void Subscribe(absl::AnyInvocable<void(Args...)> callback) {
callbacks_.AddReceiver(std::move(callback));
}
void Subscribe(const void* tag, absl::AnyInvocable<void(Args...)> callback) {
callbacks_.AddReceiver(tag, std::move(callback));
}
void Unsubscribe(const void* tag) { callbacks_.RemoveReceivers(tag); }
void Notify(Args... args) { callbacks_.Send(std::forward<Args>(args)...); }
private:
CallbackList<Args...> callbacks_;
};
template <typename T, auto member_signal>
using SignalTrampolineMemberBase =
SignalTrampolineBase<typename internal::member_pointer_traits<
decltype(member_signal)>::member_type>;
// Repeat above for mt_policy = multi_threaded_local
template <typename SignalT>
class MultiThreadSignalTrampolineBase;
template <typename... Args>
class MultiThreadSignalTrampolineBase<
sigslot::signal_with_thread_policy<sigslot::multi_threaded_local, Args...>>
: public sigslot::has_slots<sigslot::multi_threaded_local> {
public:
void Subscribe(absl::AnyInvocable<void(Args...)> callback) {
callbacks_.AddReceiver(std::move(callback));
}
void Subscribe(const void* tag, absl::AnyInvocable<void(Args...)> callback) {
callbacks_.AddReceiver(tag, std::move(callback));
}
void Unsubscribe(const void* tag) { callbacks_.RemoveReceivers(tag); }
void Notify(Args... args) { callbacks_.Send(std::forward<Args>(args)...); }
private:
CallbackList<Args...> callbacks_;
};
template <typename T, auto member_signal>
using MultiThreadSignalTrampolineMemberBase =
MultiThreadSignalTrampolineBase<typename internal::member_pointer_traits<
decltype(member_signal)>::member_type>;
} // namespace internal
template <class T, auto member_signal>
class SignalTrampoline
: public internal::SignalTrampolineMemberBase<T, member_signal> {
private:
using Base = internal::SignalTrampolineMemberBase<T, member_signal>;
public:
// Because a SignalTrampoline is initialized with a pointer to its
// container, it's not possible to move or copy it.
SignalTrampoline(const SignalTrampoline&) = delete;
SignalTrampoline& operator=(const SignalTrampoline&) = delete;
SignalTrampoline(SignalTrampoline&&) = delete;
SignalTrampoline& operator=(SignalTrampoline&&) = delete;
explicit SignalTrampoline(T* that) {
(that->*member_signal).connect(static_cast<Base*>(this), &Base::Notify);
}
};
// Note that a MultiThreadSignalTrampoline MUST be a member of the object
// of type T.
template <class T, auto member_signal>
class MultiThreadSignalTrampoline
: public internal::MultiThreadSignalTrampolineMemberBase<T, member_signal> {
private:
using Base =
internal::MultiThreadSignalTrampolineMemberBase<T, member_signal>;
public:
explicit MultiThreadSignalTrampoline(T* that) {
(that->*member_signal).connect(static_cast<Base*>(this), &Base::Notify);
owner_ = that;
}
// This disconnect avoids a lock inversion issue in sigslot.
~MultiThreadSignalTrampoline() {
(owner_->*member_signal).disconnect(static_cast<Base*>(this));
}
private:
T* owner_;
};
} // namespace webrtc
#endif // RTC_BASE_SIGSLOT_TRAMPOLINE_H_

View File

@ -1,93 +0,0 @@
/*
* Copyright 2025 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "rtc_base/sigslot_trampoline.h"
#include <utility>
#include "absl/functional/any_invocable.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "test/gmock.h"
#include "test/gtest.h"
namespace webrtc {
namespace {
using ::testing::Mock;
using ::testing::MockFunction;
using ::testing::StrictMock;
class ClassWithSlots {
public:
ClassWithSlots() : signal_0_trampoline_(this), signal_1_trampoline_(this) {}
sigslot::signal0<> Signal0;
void NotifySignal0() { Signal0(); }
void SubscribeSignal0(absl::AnyInvocable<void()> callback) {
signal_0_trampoline_.Subscribe(std::move(callback));
}
sigslot::signal1<int> Signal1;
void NotifySignal1(int arg) { Signal1(arg); }
void SubscribeSignal1(absl::AnyInvocable<void(int)> callback) {
signal_1_trampoline_.Subscribe(std::move(callback));
}
private:
SignalTrampoline<ClassWithSlots, &ClassWithSlots::Signal0>
signal_0_trampoline_;
SignalTrampoline<ClassWithSlots, &ClassWithSlots::Signal1>
signal_1_trampoline_;
};
TEST(SigslotTrampolineTest, FireSignal0) {
ClassWithSlots item;
StrictMock<MockFunction<void()>> mock_slot;
item.SubscribeSignal0(mock_slot.AsStdFunction());
Mock::VerifyAndClearExpectations(&mock_slot); // No call before Notify
EXPECT_CALL(mock_slot, Call());
item.NotifySignal0();
}
TEST(SigslotTrampolineTest, FireSignal1) {
ClassWithSlots item;
StrictMock<MockFunction<void(int)>> mock_slot;
item.SubscribeSignal1(mock_slot.AsStdFunction());
Mock::VerifyAndClearExpectations(&mock_slot); // No call before Notify
EXPECT_CALL(mock_slot, Call(7));
item.NotifySignal1(7);
}
class ClassWithMultiThreadSlots {
public:
ClassWithMultiThreadSlots() : signal_0_trampoline_(this) {}
void NotifySignal0() { Signal0(); }
void SubscribeSignal0(absl::AnyInvocable<void()> callback) {
signal_0_trampoline_.Subscribe(std::move(callback));
}
private:
sigslot::signal0<sigslot::multi_threaded_local> Signal0;
MultiThreadSignalTrampoline<ClassWithMultiThreadSlots,
&ClassWithMultiThreadSlots::Signal0>
signal_0_trampoline_;
};
TEST(SigslotTrampolineTest, FireSignal0MultiThread) {
ClassWithMultiThreadSlots item;
StrictMock<MockFunction<void()>> mock_slot;
item.SubscribeSignal0(mock_slot.AsStdFunction());
Mock::VerifyAndClearExpectations(&mock_slot); // No call before Notify
EXPECT_CALL(mock_slot, Call());
item.NotifySignal0();
}
} // namespace
} // namespace webrtc

View File

@ -26,7 +26,6 @@
#include "rtc_base/ssl_certificate.h"
#include "rtc_base/ssl_identity.h"
#include "rtc_base/ssl_stream_adapter.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/virtual_socket_server.h"
#include "test/gmock.h"
@ -60,10 +59,10 @@ class MockCertVerifier : public SSLCertificateVerifier {
// TODO(benwright) - Move to using INSTANTIATE_TEST_SUITE_P instead of using
// duplicate test cases for simple parameter changes.
class SSLAdapterTestDummy : public sigslot::has_slots<> {
class SSLAdapterTestDummy {
public:
explicit SSLAdapterTestDummy() : socket_(CreateSocket()) {}
~SSLAdapterTestDummy() override = default;
~SSLAdapterTestDummy() = default;
void CreateSSLAdapter(Socket* socket, SSLRole role) {
ssl_adapter_.reset(SSLAdapter::Create(socket));
@ -198,7 +197,7 @@ class SSLAdapterTestDummyServer : public SSLAdapterTestDummy {
std::unique_ptr<SSLIdentity> ssl_identity_;
};
class SSLAdapterTestBase : public ::testing::Test, public sigslot::has_slots<> {
class SSLAdapterTestBase : public ::testing::Test {
public:
explicit SSLAdapterTestBase(const KeyParams& key_params)
: vss_(new VirtualSocketServer()),

View File

@ -50,7 +50,6 @@
#include "rtc_base/ssl_certificate.h"
#include "rtc_base/ssl_identity.h"
#include "rtc_base/stream.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/time_utils.h"
#include "test/create_test_field_trials.h"
@ -406,8 +405,7 @@ class BufferQueueStream : public StreamInterface {
constexpr int kBufferCapacity = 1;
constexpr size_t kDefaultBufferSize = 2048;
class SSLStreamAdapterTestBase : public ::testing::Test,
public sigslot::has_slots<> {
class SSLStreamAdapterTestBase : public ::testing::Test {
public:
SSLStreamAdapterTestBase(absl::string_view client_cert_pem,
absl::string_view client_private_key_pem,

View File

@ -25,14 +25,13 @@
#include "rtc_base/socket.h"
#include "rtc_base/socket_address.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "test/wait_until.h"
namespace webrtc {
// A simple client that can send TCP or UDP data and check that it receives
// what it expects to receive. Useful for testing server functionality.
class TestClient : public sigslot::has_slots<> {
class TestClient {
public:
// Records the contents of a packet that was received.
struct Packet {
@ -55,7 +54,7 @@ class TestClient : public sigslot::has_slots<> {
// for a packet to be received, and thus it needs to advance the fake clock
// if the test is using one, rather than just sleeping.
TestClient(std::unique_ptr<AsyncPacketSocket> socket, ClockVariant clock);
~TestClient() override;
~TestClient();
TestClient(const TestClient&) = delete;
TestClient& operator=(const TestClient&) = delete;

View File

@ -8,8 +8,19 @@
import("../../../webrtc.gni")
# This target is visible to its unittest, and is visible
# to downstream projects, but is not allowed for any other
# use in webrtc.
# TODO: https://issues.webrtc.org/463409684 - move it out of libwebrtc sources
rtc_library("sigslot") {
visibility = [ "*" ]
visibility = [
"*",
"../../../rtc_base:sigslot_unittest",
# The denial rule must be last. This comment stops git cl format
# from moving it first.
"!../../../*",
]
sources = [
"sigslot.cc",
"sigslot.h",

View File

@ -172,7 +172,6 @@ if (rtc_include_tests) {
"../../rtc_base:task_queue_for_test",
"../../rtc_base:threading",
"../../rtc_base/synchronization:mutex",
"../../rtc_base/third_party/sigslot",
"//third_party/abseil-cpp/absl/functional:any_invocable",
]
}

View File

@ -95,7 +95,6 @@ if (rtc_include_tests) {
"../../rtc_base:stringutils",
"../../rtc_base:task_queue_for_test",
"../../rtc_base:threading",
"../../rtc_base/third_party/sigslot",
"../../system_wrappers",
"../logging:log_writer",
"../network:emulated_network",

View File

@ -51,14 +51,12 @@
#include "rtc_base/ssl_fingerprint.h"
#include "rtc_base/ssl_identity.h"
#include "rtc_base/task_queue_for_test.h"
#include "rtc_base/third_party/sigslot/sigslot.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
#include "test/network/network_emulation_manager.h"
namespace webrtc {
class ScenarioIceConnectionImpl : public ScenarioIceConnection,
public sigslot::has_slots<>,
private JsepTransportController::Observer,
private RtpPacketSinkInterface {
public: