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}
diff --git a/BUILD.gn b/BUILD.gn
index 5bbc5b7..9b17a0b 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -665,7 +665,6 @@
"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",
diff --git a/examples/BUILD.gn b/examples/BUILD.gn
index 02f2592..915d8c2 100644
--- a/examples/BUILD.gn
+++ b/examples/BUILD.gn
@@ -721,7 +721,6 @@
"../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",
diff --git a/media/BUILD.gn b/media/BUILD.gn
index d8e6464..212f11d 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -125,7 +125,6 @@
"../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 @@
"../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",
diff --git a/p2p/BUILD.gn b/p2p/BUILD.gn
index adc2c36..1fc8431 100644
--- a/p2p/BUILD.gn
+++ b/p2p/BUILD.gn
@@ -827,7 +827,6 @@
"../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_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 @@
"../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 @@
"../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",
diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc
index b9d3a55..b38e4ea 100644
--- a/p2p/base/p2p_transport_channel_unittest.cc
+++ b/p2p/base/p2p_transport_channel_unittest.cc
@@ -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 @@
// 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>()),
diff --git a/p2p/base/stun_port_unittest.cc b/p2p/base/stun_port_unittest.cc
index d318fda..4d7c2b1 100644
--- a/p2p/base/stun_port_unittest.cc
+++ b/p2p/base/stun_port_unittest.cc
@@ -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 @@
// 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(),
diff --git a/p2p/base/tcp_port.h b/p2p/base/tcp_port.h
index 9adc6b4..130e249 100644
--- a/p2p/base/tcp_port.h
+++ b/p2p/base/tcp_port.h
@@ -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 @@
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,
diff --git a/p2p/base/turn_port.cc b/p2p/base/turn_port.cc
index e8838b2..2b78a7f 100644
--- a/p2p/base/turn_port.cc
+++ b/p2p/base/turn_port.cc
@@ -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 @@
// 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_; }
diff --git a/p2p/base/turn_port_unittest.cc b/p2p/base/turn_port_unittest.cc
index 65c6fd2..81a7c55 100644
--- a/p2p/base/turn_port_unittest.cc
+++ b/p2p/base/turn_port_unittest.cc
@@ -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 @@
// 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()),
diff --git a/p2p/client/basic_port_allocator_unittest.cc b/p2p/client/basic_port_allocator_unittest.cc
index 5969fd2..6f76a4a 100644
--- a/p2p/client/basic_port_allocator_unittest.cc
+++ b/p2p/client/basic_port_allocator_unittest.cc
@@ -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 @@
namespace webrtc {
-class BasicPortAllocatorTestBase : public ::testing::Test,
- public sigslot::has_slots<> {
+class BasicPortAllocatorTestBase : public ::testing::Test {
public:
BasicPortAllocatorTestBase()
: vss_(new VirtualSocketServer()),
diff --git a/p2p/dtls/dtls_ice_integrationtest.cc b/p2p/dtls/dtls_ice_integrationtest.cc
index 2228d5b..5b97f4c 100644
--- a/p2p/dtls/dtls_ice_integrationtest.cc
+++ b/p2p/dtls/dtls_ice_integrationtest.cc
@@ -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 @@
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(
diff --git a/p2p/test/nat_socket_factory.cc b/p2p/test/nat_socket_factory.cc
index c45168c..f7f24e7 100644
--- a/p2p/test/nat_socket_factory.cc
+++ b/p2p/test/nat_socket_factory.cc
@@ -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 @@
}
// NATSocket
-class NATSocket : public Socket, public sigslot::has_slots<> {
+class NATSocket : public Socket {
public:
explicit NATSocket(NATInternalSocketFactory* sf, int family, int type)
: sf_(sf),
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index dbfe752..b97f8b5 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -2299,7 +2299,6 @@
"../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",
diff --git a/pc/datagram_connection_unittest.cc b/pc/datagram_connection_unittest.cc
index 6a7de66..4d60d3f 100644
--- a/pc/datagram_connection_unittest.cc
+++ b/pc/datagram_connection_unittest.cc
@@ -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 @@
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([] {});
}
diff --git a/pc/jsep_transport_controller_unittest.cc b/pc/jsep_transport_controller_unittest.cc
index 4422916..5b63991 100644
--- a/pc/jsep_transport_controller_unittest.cc
+++ b/pc/jsep_transport_controller_unittest.cc
@@ -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 JsepTransportControllerTest : public JsepTransportController::Observer,
- public ::testing::Test,
- public sigslot::has_slots<> {
+ public ::testing::Test {
public:
JsepTransportControllerTest()
: env_(CreateEnvironment(&field_trials_)),
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index e4c9a44..8183b1f 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1029,7 +1029,6 @@
"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_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 @@
":socket",
"../test:create_test_environment",
"../test:test_support",
- "third_party/sigslot",
]
}
}
@@ -1773,7 +1751,6 @@
"../test:wait_until",
"network:received_packet",
"synchronization:mutex",
- "third_party/sigslot",
]
}
@@ -1838,7 +1815,6 @@
":network",
":network_constants",
":rtc_event",
- ":sigslot_trampoline",
":socket",
":socket_adapters",
":socket_address",
@@ -1866,7 +1842,6 @@
"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 @@
"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",
diff --git a/rtc_base/async_tcp_socket_unittest.cc b/rtc_base/async_tcp_socket_unittest.cc
index 97f5132..69a61a0 100644
--- a/rtc_base/async_tcp_socket_unittest.cc
+++ b/rtc_base/async_tcp_socket_unittest.cc
@@ -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 @@
using ::testing::NotNull;
-struct AsyncTCPSocketObserver : public sigslot::has_slots<> {
+struct AsyncTCPSocketObserver {
void OnReadyToSend(AsyncPacketSocket* socket) { ready_to_send = true; }
bool ready_to_send = false;
diff --git a/rtc_base/network_unittest.cc b/rtc_base/network_unittest.cc
index ebb17c1..9075353 100644
--- a/rtc_base/network_unittest.cc
+++ b/rtc_base/network_unittest.cc
@@ -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 @@
} // namespace
-class NetworkTest : public ::testing::Test, public sigslot::has_slots<> {
+class NetworkTest : public ::testing::Test {
public:
void OnNetworksChanged() { callback_called_ = true; }
diff --git a/rtc_base/openssl_adapter_unittest.cc b/rtc_base/openssl_adapter_unittest.cc
index 3808a0d..7f64cbf 100644
--- a/rtc_base/openssl_adapter_unittest.cc
+++ b/rtc_base/openssl_adapter_unittest.cc
@@ -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"
diff --git a/rtc_base/physical_socket_server.h b/rtc_base/physical_socket_server.h
index d50f9b0..0fb410b 100644
--- a/rtc_base/physical_socket_server.h
+++ b/rtc_base/physical_socket_server.h
@@ -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 @@
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;
diff --git a/rtc_base/sigslot_trampoline.h b/rtc_base/sigslot_trampoline.h
deleted file mode 100644
index f99e14c..0000000
--- a/rtc_base/sigslot_trampoline.h
+++ /dev/null
@@ -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_
diff --git a/rtc_base/sigslot_trampoline_unittest.cc b/rtc_base/sigslot_trampoline_unittest.cc
deleted file mode 100644
index 5c1cd3d..0000000
--- a/rtc_base/sigslot_trampoline_unittest.cc
+++ /dev/null
@@ -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
diff --git a/rtc_base/ssl_adapter_unittest.cc b/rtc_base/ssl_adapter_unittest.cc
index 81dc422..94b288e 100644
--- a/rtc_base/ssl_adapter_unittest.cc
+++ b/rtc_base/ssl_adapter_unittest.cc
@@ -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 @@
// 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 @@
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()),
diff --git a/rtc_base/ssl_stream_adapter_unittest.cc b/rtc_base/ssl_stream_adapter_unittest.cc
index 6c19323..ef519e3 100644
--- a/rtc_base/ssl_stream_adapter_unittest.cc
+++ b/rtc_base/ssl_stream_adapter_unittest.cc
@@ -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 @@
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,
diff --git a/rtc_base/test_client.h b/rtc_base/test_client.h
index 68c7705..4d498b3 100644
--- a/rtc_base/test_client.h
+++ b/rtc_base/test_client.h
@@ -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 @@
// 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;
diff --git a/rtc_base/third_party/sigslot/BUILD.gn b/rtc_base/third_party/sigslot/BUILD.gn
index 186a05c..3833cc8 100644
--- a/rtc_base/third_party/sigslot/BUILD.gn
+++ b/rtc_base/third_party/sigslot/BUILD.gn
@@ -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",
diff --git a/test/network/BUILD.gn b/test/network/BUILD.gn
index 57f8682..e4ada7d 100644
--- a/test/network/BUILD.gn
+++ b/test/network/BUILD.gn
@@ -172,7 +172,6 @@
"../../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",
]
}
diff --git a/test/peer_scenario/BUILD.gn b/test/peer_scenario/BUILD.gn
index 4aca052..0d1c68d 100644
--- a/test/peer_scenario/BUILD.gn
+++ b/test/peer_scenario/BUILD.gn
@@ -95,7 +95,6 @@
"../../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",
diff --git a/test/peer_scenario/scenario_connection.cc b/test/peer_scenario/scenario_connection.cc
index 388da87..c78d406 100644
--- a/test/peer_scenario/scenario_connection.cc
+++ b/test/peer_scenario/scenario_connection.cc
@@ -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: