[CallbackList] Use CallbackList in AsyncPacketSocket for close events.

This removes use of the SignalClose sigslot. This CL includes thread
checks for the callback list and updates some call sites to unsubscribe
from events before deletion or detaching from a socket instance.

Bug: webrtc:11943
Change-Id: Ib66d39aa5cc795b750c9e3eaa85ed6af8b55b2b5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258561
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36540}
This commit is contained in:
Tomas Gunnarsson
2022-04-13 09:03:52 +00:00
committed by WebRTC LUCI CQ
parent a19f0c7409
commit f15189dbce
10 changed files with 73 additions and 14 deletions

View File

@ -68,7 +68,6 @@ AsyncTCPSocketBase::AsyncTCPSocketBase(Socket* socket,
max_outsize_(max_packet_size) {
inbuf_.EnsureCapacity(kMinimumRecvSize);
RTC_DCHECK(socket_.get() != nullptr);
socket_->SignalConnectEvent.connect(this,
&AsyncTCPSocketBase::OnConnectEvent);
socket_->SignalReadEvent.connect(this, &AsyncTCPSocketBase::OnReadEvent);
@ -237,7 +236,7 @@ void AsyncTCPSocketBase::OnWriteEvent(Socket* socket) {
}
void AsyncTCPSocketBase::OnCloseEvent(Socket* socket, int error) {
SignalClose(this, error);
NotifyClosed(error);
}
// AsyncTCPSocket