From af27d4ea384ad903f3ba511db28623b0788aae4c Mon Sep 17 00:00:00 2001 From: Tommi Date: Tue, 24 Oct 2023 23:49:31 +0200 Subject: [PATCH] Initialize worker_thread_safety_ without BlockingCall(). Bug: webrtc:15099 Change-Id: Iac448c768fb90154fbe5b64fb12d68398a314e9a Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/324281 Reviewed-by: Danil Chapovalov Commit-Queue: Tomas Gunnarsson Cr-Commit-Position: refs/heads/main@{#41009} --- pc/peer_connection.cc | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc index 4831acc394..046e08f3fd 100644 --- a/pc/peer_connection.cc +++ b/pc/peer_connection.cc @@ -639,6 +639,9 @@ PeerConnection::PeerConnection( ice_transport_factory_(std::move(dependencies.ice_transport_factory)), tls_cert_verifier_(std::move(dependencies.tls_cert_verifier)), call_(std::move(call)), + worker_thread_safety_(PendingTaskSafetyFlag::CreateAttachedToTaskQueue( + /*alive=*/call_ != nullptr, + worker_thread())), call_ptr_(call_.get()), // RFC 3264: The numeric value of the session id and version in the // o line MUST be representable with a "64 bit signed integer". @@ -648,14 +651,7 @@ PeerConnection::PeerConnection( dtls_enabled_(dtls_enabled), data_channel_controller_(this), message_handler_(signaling_thread()), - weak_factory_(this) { - worker_thread()->BlockingCall([this] { - RTC_DCHECK_RUN_ON(worker_thread()); - worker_thread_safety_ = PendingTaskSafetyFlag::Create(); - if (!call_) - worker_thread_safety_->SetNotAlive(); - }); -} + weak_factory_(this) {} PeerConnection::~PeerConnection() { TRACE_EVENT0("webrtc", "PeerConnection::~PeerConnection");