Replace Thread::Invoke with Thread::BlockingCall

BlockingCall doesn't take rtc::Location parameter and thus most of the dependencies on location can be removed

Bug: webrtc:11318
Change-Id: I91a17e342dd9a9e3e2c8f7fbe267474c98a8d0e5
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/274620
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38045}
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index e99fc01..46bf22d 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -87,7 +87,6 @@
     "../rtc_base:checks",
     "../rtc_base:copy_on_write_buffer",
     "../rtc_base:event_tracer",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:socket",
@@ -294,7 +293,6 @@
     "../rtc_base:checks",
     "../rtc_base:copy_on_write_buffer",
     "../rtc_base:event_tracer",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:threading",
@@ -482,7 +480,6 @@
     "../p2p:rtc_p2p",
     "../rtc_base",
     "../rtc_base:checks",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:threading",
@@ -854,7 +851,6 @@
     "../media:rtc_media_base",
     "../rtc_base:checks",
     "../rtc_base:copy_on_write_buffer",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:rtc_base",
@@ -935,7 +931,6 @@
     "../rtc_base",
     "../rtc_base:checks",
     "../rtc_base:copy_on_write_buffer",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:threading",
@@ -1021,7 +1016,6 @@
     "../rtc_base:checks",
     "../rtc_base:event_tracer",
     "../rtc_base:ip_address",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:network_constants",
     "../rtc_base:refcount",
@@ -1107,7 +1101,6 @@
     "../rtc_base",
     "../rtc_base:checks",
     "../rtc_base:event_tracer",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:rtc_operations_chain",
@@ -1209,7 +1202,6 @@
     "../rtc_base:copy_on_write_buffer",
     "../rtc_base:event_tracer",
     "../rtc_base:ip_address",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:network_constants",
@@ -1294,7 +1286,6 @@
     "../rtc_base:checks",
     "../rtc_base:event_tracer",
     "../rtc_base:ip_address",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:network_constants",
@@ -1484,7 +1475,6 @@
     "../pc:session_description",
     "../pc:video_track",
     "../rtc_base:checks",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:rtc_base",
@@ -1561,7 +1551,6 @@
     "../api/video:video_bitrate_allocator_factory",
     "../media:rtc_media_base",
     "../rtc_base:checks",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:threading",
@@ -1693,7 +1682,6 @@
     "../media:rtc_media_base",
     "../rtc_base",
     "../rtc_base:checks",
-    "../rtc_base:location",
     "../rtc_base:macromagic",
     "../rtc_base:threading",
     "../rtc_base/system:no_unique_address",
@@ -1732,7 +1720,6 @@
     "../media:rtc_media_base",
     "../rtc_base",
     "../rtc_base:checks",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:threading",
@@ -1795,7 +1782,6 @@
     "../media:rtc_media_base",
     "../rtc_base",
     "../rtc_base:checks",
-    "../rtc_base:location",
     "../rtc_base:macromagic",
     "../rtc_base:threading",
     "../rtc_base/system:no_unique_address",
@@ -1877,7 +1863,6 @@
     "../media:rtc_media_base",
     "../rtc_base:checks",
     "../rtc_base:event_tracer",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:rtc_base",
@@ -1932,7 +1917,6 @@
     "../api/task_queue:pending_task_safety_flag",
     "../api/units:time_delta",
     "../rtc_base:checks",
-    "../rtc_base:location",
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:refcount",
diff --git a/pc/audio_rtp_receiver.cc b/pc/audio_rtp_receiver.cc
index e58b74e..0dbdf0b 100644
--- a/pc/audio_rtp_receiver.cc
+++ b/pc/audio_rtp_receiver.cc
@@ -20,7 +20,6 @@
 #include "pc/audio_track.h"
 #include "pc/media_stream_track_proxy.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/location.h"
 
 namespace webrtc {
 
@@ -101,7 +100,7 @@
   RTC_DCHECK_LE(volume, 10);
 
   bool track_enabled = track_->internal()->enabled();
-  worker_thread_->Invoke<void>(RTC_FROM_HERE, [&]() {
+  worker_thread_->BlockingCall([&]() {
     RTC_DCHECK_RUN_ON(worker_thread_);
     // Update the cached_volume_ even when stopped, to allow clients to set
     // the volume before starting/restarting, eg see crbug.com/1272566.
@@ -168,7 +167,7 @@
   RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
   bool enabled = track_->internal()->enabled();
   MediaSourceInterface::SourceState state = source_->state();
-  worker_thread_->Invoke<void>(RTC_FROM_HERE, [&]() {
+  worker_thread_->BlockingCall([&]() {
     RTC_DCHECK_RUN_ON(worker_thread_);
     RestartMediaChannel_w(std::move(ssrc), enabled, state);
   });
diff --git a/pc/channel.cc b/pc/channel.cc
index 0777314..0e2345b 100644
--- a/pc/channel.cc
+++ b/pc/channel.cc
@@ -29,7 +29,6 @@
 #include "pc/rtp_media_utils.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/copy_on_write_buffer.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/network_route.h"
 #include "rtc_base/strings/string_format.h"
@@ -269,8 +268,8 @@
   // network thread. At the moment there's a workaround for inconsistent state
   // between the worker and network thread because of this (see
   // OnDemuxerCriteriaUpdatePending elsewhere in this file) and
-  // SetPayloadTypeDemuxingEnabled_w has an Invoke over to the network thread
-  // to apply state updates.
+  // SetPayloadTypeDemuxingEnabled_w has a BlockingCall over to the network
+  // thread to apply state updates.
   RTC_DCHECK_RUN_ON(worker_thread());
   TRACE_EVENT0("webrtc", "BaseChannel::SetPayloadTypeDemuxingEnabled");
   return SetPayloadTypeDemuxingEnabled_w(enabled);
@@ -461,7 +460,7 @@
   if (update_demuxer)
     media_channel()->OnDemuxerCriteriaUpdatePending();
 
-  bool success = network_thread()->Invoke<bool>(RTC_FROM_HERE, [&]() mutable {
+  bool success = network_thread()->BlockingCall([&]() mutable {
     RTC_DCHECK_RUN_ON(network_thread());
     // NOTE: This doesn't take the BUNDLE case in account meaning the RTP header
     // extension maps are not merged when BUNDLE is enabled. This is fine
@@ -491,8 +490,8 @@
   media_channel_->OnDemuxerCriteriaUpdatePending();
   // Copy demuxer criteria, since they're a worker-thread variable
   // and we want to pass them to the network thread
-  bool ret = network_thread_->Invoke<bool>(
-      RTC_FROM_HERE, [this, demuxer_criteria = demuxer_criteria_] {
+  bool ret = network_thread_->BlockingCall(
+      [this, demuxer_criteria = demuxer_criteria_] {
         RTC_DCHECK_RUN_ON(network_thread());
         if (!rtp_transport_) {
           // Transport was disconnected before attempting to update the
diff --git a/pc/connection_context.cc b/pc/connection_context.cc
index 13c598a..ec6f21c 100644
--- a/pc/connection_context.cc
+++ b/pc/connection_context.cc
@@ -167,13 +167,13 @@
   if (media_engine_) {
     // TODO(tommi): Change VoiceEngine to do ctor time initialization so that
     // this isn't necessary.
-    worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] { media_engine_->Init(); });
+    worker_thread_->BlockingCall([&] { media_engine_->Init(); });
   }
 }
 
 ConnectionContext::~ConnectionContext() {
   RTC_DCHECK_RUN_ON(signaling_thread_);
-  worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
+  worker_thread_->BlockingCall([&] {
     RTC_DCHECK_RUN_ON(worker_thread());
     // While `media_engine_` is const throughout the ConnectionContext's
     // lifetime, it requires destruction to happen on the worker thread. Instead
diff --git a/pc/data_channel_controller.cc b/pc/data_channel_controller.cc
index b655b53..36f11fe 100644
--- a/pc/data_channel_controller.cc
+++ b/pc/data_channel_controller.cc
@@ -16,7 +16,6 @@
 #include "api/rtc_error.h"
 #include "pc/peer_connection_internal.h"
 #include "pc/sctp_utils.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 
 namespace webrtc {
@@ -81,7 +80,7 @@
 
 void DataChannelController::AddSctpDataStream(int sid) {
   if (data_channel_transport()) {
-    network_thread()->Invoke<void>(RTC_FROM_HERE, [this, sid] {
+    network_thread()->BlockingCall([this, sid] {
       if (data_channel_transport()) {
         data_channel_transport()->OpenChannel(sid);
       }
@@ -91,7 +90,7 @@
 
 void DataChannelController::RemoveSctpDataStream(int sid) {
   if (data_channel_transport()) {
-    network_thread()->Invoke<void>(RTC_FROM_HERE, [this, sid] {
+    network_thread()->BlockingCall([this, sid] {
       if (data_channel_transport()) {
         data_channel_transport()->CloseChannel(sid);
       }
@@ -382,15 +381,14 @@
     const rtc::CopyOnWriteBuffer& payload,
     cricket::SendDataResult* result) {
   // TODO(bugs.webrtc.org/11547): Expect method to be called on the network
-  // thread instead. Remove the Invoke() below and move assocated state to
+  // thread instead. Remove the BlockingCall() below and move assocated state to
   // the network thread.
   RTC_DCHECK_RUN_ON(signaling_thread());
   RTC_DCHECK(data_channel_transport());
 
-  RTCError error = network_thread()->Invoke<RTCError>(
-      RTC_FROM_HERE, [this, sid, params, payload] {
-        return data_channel_transport()->SendData(sid, params, payload);
-      });
+  RTCError error = network_thread()->BlockingCall([this, sid, params, payload] {
+    return data_channel_transport()->SendData(sid, params, payload);
+  });
 
   if (error.ok()) {
     *result = cricket::SendDataResult::SDR_SUCCESS;
diff --git a/pc/dtmf_sender.cc b/pc/dtmf_sender.cc
index c3bd4b6..45a4a58 100644
--- a/pc/dtmf_sender.cc
+++ b/pc/dtmf_sender.cc
@@ -142,7 +142,7 @@
   }
   safety_flag_ = PendingTaskSafetyFlag::Create();
   // Kick off a new DTMF task.
-  QueueInsertDtmf(RTC_FROM_HERE, 1 /*ms*/);
+  QueueInsertDtmf(1 /*ms*/);
   return true;
 }
 
@@ -166,8 +166,7 @@
   return comma_delay_;
 }
 
-void DtmfSender::QueueInsertDtmf(const rtc::Location& posted_from,
-                                 uint32_t delay_ms) {
+void DtmfSender::QueueInsertDtmf(uint32_t delay_ms) {
   signaling_thread_->PostDelayedHighPrecisionTask(
       SafeTask(safety_flag_,
                [this] {
@@ -232,7 +231,7 @@
   tones_.erase(0, first_tone_pos + 1);
 
   // Continue with the next tone.
-  QueueInsertDtmf(RTC_FROM_HERE, tone_gap);
+  QueueInsertDtmf(tone_gap);
 }
 
 void DtmfSender::StopSending() {
diff --git a/pc/dtmf_sender.h b/pc/dtmf_sender.h
index c295f03..c99c7be 100644
--- a/pc/dtmf_sender.h
+++ b/pc/dtmf_sender.h
@@ -21,7 +21,6 @@
 #include "api/task_queue/pending_task_safety_flag.h"
 #include "api/task_queue/task_queue_base.h"
 #include "pc/proxy.h"
-#include "rtc_base/location.h"
 #include "rtc_base/ref_count.h"
 #include "rtc_base/thread_annotations.h"
 
@@ -77,8 +76,7 @@
  private:
   DtmfSender();
 
-  void QueueInsertDtmf(const rtc::Location& posted_from, uint32_t delay_ms)
-      RTC_RUN_ON(signaling_thread_);
+  void QueueInsertDtmf(uint32_t delay_ms) RTC_RUN_ON(signaling_thread_);
 
   // The DTMF sending task.
   void DoInsertDtmf() RTC_RUN_ON(signaling_thread_);
diff --git a/pc/jsep_transport_controller.cc b/pc/jsep_transport_controller.cc
index 7b44574..95ab799 100644
--- a/pc/jsep_transport_controller.cc
+++ b/pc/jsep_transport_controller.cc
@@ -29,7 +29,6 @@
 #include "p2p/base/p2p_constants.h"
 #include "p2p/base/port.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/thread.h"
 #include "rtc_base/trace_event.h"
@@ -77,8 +76,8 @@
     const cricket::SessionDescription* description) {
   TRACE_EVENT0("webrtc", "JsepTransportController::SetLocalDescription");
   if (!network_thread_->IsCurrent()) {
-    return network_thread_->Invoke<RTCError>(
-        RTC_FROM_HERE, [=] { return SetLocalDescription(type, description); });
+    return network_thread_->BlockingCall(
+        [=] { return SetLocalDescription(type, description); });
   }
 
   RTC_DCHECK_RUN_ON(network_thread_);
@@ -98,8 +97,8 @@
     const cricket::SessionDescription* description) {
   TRACE_EVENT0("webrtc", "JsepTransportController::SetRemoteDescription");
   if (!network_thread_->IsCurrent()) {
-    return network_thread_->Invoke<RTCError>(
-        RTC_FROM_HERE, [=] { return SetRemoteDescription(type, description); });
+    return network_thread_->BlockingCall(
+        [=] { return SetRemoteDescription(type, description); });
   }
 
   RTC_DCHECK_RUN_ON(network_thread_);
@@ -199,8 +198,7 @@
   // thread during negotiations, potentially multiple times.
   // WebRtcSessionDescriptionFactory::InternalCreateAnswer is one example.
   if (!network_thread_->IsCurrent()) {
-    return network_thread_->Invoke<absl::optional<rtc::SSLRole>>(
-        RTC_FROM_HERE, [&] { return GetDtlsRole(mid); });
+    return network_thread_->BlockingCall([&] { return GetDtlsRole(mid); });
   }
 
   RTC_DCHECK_RUN_ON(network_thread_);
@@ -215,8 +213,8 @@
 bool JsepTransportController::SetLocalCertificate(
     const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {
   if (!network_thread_->IsCurrent()) {
-    return network_thread_->Invoke<bool>(
-        RTC_FROM_HERE, [&] { return SetLocalCertificate(certificate); });
+    return network_thread_->BlockingCall(
+        [&] { return SetLocalCertificate(certificate); });
   }
 
   RTC_DCHECK_RUN_ON(network_thread_);
@@ -274,8 +272,7 @@
 
 void JsepTransportController::MaybeStartGathering() {
   if (!network_thread_->IsCurrent()) {
-    network_thread_->Invoke<void>(RTC_FROM_HERE,
-                                  [&] { MaybeStartGathering(); });
+    network_thread_->BlockingCall([&] { MaybeStartGathering(); });
     return;
   }
 
@@ -301,8 +298,8 @@
 RTCError JsepTransportController::RemoveRemoteCandidates(
     const cricket::Candidates& candidates) {
   if (!network_thread_->IsCurrent()) {
-    return network_thread_->Invoke<RTCError>(
-        RTC_FROM_HERE, [&] { return RemoveRemoteCandidates(candidates); });
+    return network_thread_->BlockingCall(
+        [&] { return RemoveRemoteCandidates(candidates); });
   }
 
   RTC_DCHECK_RUN_ON(network_thread_);
@@ -361,9 +358,8 @@
 void JsepTransportController::SetActiveResetSrtpParams(
     bool active_reset_srtp_params) {
   if (!network_thread_->IsCurrent()) {
-    network_thread_->Invoke<void>(RTC_FROM_HERE, [=] {
-      SetActiveResetSrtpParams(active_reset_srtp_params);
-    });
+    network_thread_->BlockingCall(
+        [=] { SetActiveResetSrtpParams(active_reset_srtp_params); });
     return;
   }
   RTC_DCHECK_RUN_ON(network_thread_);
@@ -378,8 +374,7 @@
 
 RTCError JsepTransportController::RollbackTransports() {
   if (!network_thread_->IsCurrent()) {
-    return network_thread_->Invoke<RTCError>(
-        RTC_FROM_HERE, [=] { return RollbackTransports(); });
+    return network_thread_->BlockingCall([=] { return RollbackTransports(); });
   }
   RTC_DCHECK_RUN_ON(network_thread_);
   bundles_.Rollback();
diff --git a/pc/legacy_stats_collector.cc b/pc/legacy_stats_collector.cc
index 393e0ef..b710bc1 100644
--- a/pc/legacy_stats_collector.cc
+++ b/pc/legacy_stats_collector.cc
@@ -46,7 +46,6 @@
 #include "pc/transport_stats.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/ip_address.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/rtc_certificate.h"
 #include "rtc_base/socket_address.h"
@@ -861,9 +860,9 @@
 
   SessionStats stats;
   auto transceivers = pc_->GetTransceiversInternal();
-  pc_->network_thread()->Invoke<void>(
-      RTC_FROM_HERE, [&, sctp_transport_name = pc_->sctp_transport_name(),
-                      sctp_mid = pc_->sctp_mid()]() mutable {
+  pc_->network_thread()->BlockingCall(
+      [&, sctp_transport_name = pc_->sctp_transport_name(),
+       sctp_mid = pc_->sctp_mid()]() mutable {
         stats = ExtractSessionInfo_n(
             transceivers, std::move(sctp_transport_name), std::move(sctp_mid));
       });
@@ -1049,7 +1048,7 @@
   }
 
   if (!video_media_channels.empty()) {
-    pc_->worker_thread()->Invoke<void>(RTC_FROM_HERE, [&] {
+    pc_->worker_thread()->BlockingCall([&] {
       for (const auto& channel : video_media_channels) {
         channel->FillBitrateInfo(&bwe_info);
       }
@@ -1200,7 +1199,7 @@
     }
   }
 
-  pc_->worker_thread()->Invoke<void>(RTC_FROM_HERE, [&] {
+  pc_->worker_thread()->BlockingCall([&] {
     rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls;
     // Populate `receiver_track_id_by_ssrc` for the gatherers.
     int i = 0;
diff --git a/pc/peer_connection.cc b/pc/peer_connection.cc
index 1c0e695..517669d 100644
--- a/pc/peer_connection.cc
+++ b/pc/peer_connection.cc
@@ -52,7 +52,6 @@
 #include "pc/webrtc_session_description_factory.h"
 #include "rtc_base/helpers.h"
 #include "rtc_base/ip_address.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/net_helper.h"
 #include "rtc_base/network.h"
@@ -525,7 +524,7 @@
       data_channel_controller_(this),
       message_handler_(signaling_thread()),
       weak_factory_(this) {
-  worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+  worker_thread()->BlockingCall([this] {
     RTC_DCHECK_RUN_ON(worker_thread());
     worker_thread_safety_ = PendingTaskSafetyFlag::Create();
     if (!call_)
@@ -569,7 +568,7 @@
   // port_allocator_ and transport_controller_ live on the network thread and
   // should be destroyed there.
   transport_controller_copy_ = nullptr;
-  network_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+  network_thread()->BlockingCall([this] {
     RTC_DCHECK_RUN_ON(network_thread());
     TeardownDataChannelTransport_n();
     transport_controller_.reset();
@@ -579,7 +578,7 @@
   });
 
   // call_ and event_log_ must be destroyed on the worker thread.
-  worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+  worker_thread()->BlockingCall([this] {
     RTC_DCHECK_RUN_ON(worker_thread());
     worker_thread_safety_->SetNotAlive();
     call_.reset();
@@ -618,7 +617,7 @@
 
   // Network thread initialization.
   transport_controller_copy_ =
-      network_thread()->Invoke<JsepTransportController*>(RTC_FROM_HERE, [&] {
+      network_thread()->BlockingCall([&] {
         RTC_DCHECK_RUN_ON(network_thread());
         network_thread_safety_ = PendingTaskSafetyFlag::Create();
         InitializePortAllocatorResult pa_result = InitializePortAllocator_n(
@@ -940,13 +939,12 @@
   // TODO(bugs.webrtc.org/9987): Avoid the thread jump.
   // This might be done by caching the value on the signaling thread.
   RTC_DCHECK_RUN_ON(signaling_thread());
-  return network_thread()->Invoke<RtpTransportInternal*>(
-      RTC_FROM_HERE, [this, &mid] {
-        RTC_DCHECK_RUN_ON(network_thread());
-        auto rtp_transport = transport_controller_->GetRtpTransport(mid);
-        RTC_DCHECK(rtp_transport);
-        return rtp_transport;
-      });
+  return network_thread()->BlockingCall([this, &mid] {
+    RTC_DCHECK_RUN_ON(network_thread());
+    auto rtp_transport = transport_controller_->GetRtpTransport(mid);
+    RTC_DCHECK(rtp_transport);
+    return rtp_transport;
+  });
 }
 
 RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
@@ -1556,8 +1554,7 @@
 
   // Apply part of the configuration on the network thread.  In theory this
   // shouldn't fail.
-  if (!network_thread()->Invoke<bool>(
-          RTC_FROM_HERE,
+  if (!network_thread()->BlockingCall(
           [this, needs_ice_restart, &ice_config, &stun_servers, &turn_servers,
            &modified_config, has_local_description] {
             RTC_DCHECK_RUN_ON(network_thread());
@@ -1583,8 +1580,8 @@
 
   if (configuration_.active_reset_srtp_params !=
       modified_config.active_reset_srtp_params) {
-    // TODO(tommi): merge invokes
-    network_thread()->Invoke<void>(RTC_FROM_HERE, [this, &modified_config] {
+    // TODO(tommi): merge BlockingCalls
+    network_thread()->BlockingCall([this, &modified_config] {
       RTC_DCHECK_RUN_ON(network_thread());
       transport_controller_->SetActiveResetSrtpParams(
           modified_config.active_reset_srtp_params);
@@ -1603,8 +1600,7 @@
             video_channel->media_channel()));
     }
 
-    worker_thread()->Invoke<void>(
-        RTC_FROM_HERE,
+    worker_thread()->BlockingCall(
         [channels = std::move(channels),
          allow_codec_switching = *modified_config.allow_codec_switching]() {
           for (auto* ch : channels)
@@ -1643,8 +1639,7 @@
 
 RTCError PeerConnection::SetBitrate(const BitrateSettings& bitrate) {
   if (!worker_thread()->IsCurrent()) {
-    return worker_thread()->Invoke<RTCError>(
-        RTC_FROM_HERE, [&]() { return SetBitrate(bitrate); });
+    return worker_thread()->BlockingCall([&]() { return SetBitrate(bitrate); });
   }
   RTC_DCHECK_RUN_ON(worker_thread());
 
@@ -1685,8 +1680,8 @@
 
 void PeerConnection::SetAudioPlayout(bool playout) {
   if (!worker_thread()->IsCurrent()) {
-    worker_thread()->Invoke<void>(
-        RTC_FROM_HERE, [this, playout] { SetAudioPlayout(playout); });
+    worker_thread()->BlockingCall(
+        [this, playout] { SetAudioPlayout(playout); });
     return;
   }
   auto audio_state = context_->media_engine()->voice().GetAudioState();
@@ -1695,8 +1690,8 @@
 
 void PeerConnection::SetAudioRecording(bool recording) {
   if (!worker_thread()->IsCurrent()) {
-    worker_thread()->Invoke<void>(
-        RTC_FROM_HERE, [this, recording] { SetAudioRecording(recording); });
+    worker_thread()->BlockingCall(
+        [this, recording] { SetAudioRecording(recording); });
     return;
   }
   auto audio_state = context_->media_engine()->voice().GetAudioState();
@@ -1706,9 +1701,8 @@
 void PeerConnection::AddAdaptationResource(
     rtc::scoped_refptr<Resource> resource) {
   if (!worker_thread()->IsCurrent()) {
-    return worker_thread()->Invoke<void>(RTC_FROM_HERE, [this, resource]() {
-      return AddAdaptationResource(resource);
-    });
+    return worker_thread()->BlockingCall(
+        [this, resource]() { return AddAdaptationResource(resource); });
   }
   RTC_DCHECK_RUN_ON(worker_thread());
   if (!call_) {
@@ -1724,8 +1718,7 @@
 
 bool PeerConnection::StartRtcEventLog(std::unique_ptr<RtcEventLogOutput> output,
                                       int64_t output_period_ms) {
-  return worker_thread()->Invoke<bool>(
-      RTC_FROM_HERE,
+  return worker_thread()->BlockingCall(
       [this, output = std::move(output), output_period_ms]() mutable {
         return StartRtcEventLog_w(std::move(output), output_period_ms);
       });
@@ -1741,7 +1734,7 @@
 }
 
 void PeerConnection::StopRtcEventLog() {
-  worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] { StopRtcEventLog_w(); });
+  worker_thread()->BlockingCall([this] { StopRtcEventLog_w(); });
 }
 
 rtc::scoped_refptr<DtlsTransportInterface>
@@ -1755,11 +1748,10 @@
   RTC_DCHECK_RUN_ON(signaling_thread());
   // TODO(bugs.webrtc.org/9987): Avoid the thread jump.
   // This might be done by caching the value on the signaling thread.
-  return network_thread()->Invoke<rtc::scoped_refptr<DtlsTransport>>(
-      RTC_FROM_HERE, [this, mid]() {
-        RTC_DCHECK_RUN_ON(network_thread());
-        return transport_controller_->LookupDtlsTransportByMid(mid);
-      });
+  return network_thread()->BlockingCall([this, mid]() {
+    RTC_DCHECK_RUN_ON(network_thread());
+    return transport_controller_->LookupDtlsTransportByMid(mid);
+  });
 }
 
 rtc::scoped_refptr<SctpTransportInterface> PeerConnection::GetSctpTransport()
@@ -1856,7 +1848,7 @@
     rtp_manager_->Close();
   }
 
-  network_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+  network_thread()->BlockingCall([this] {
     // Data channels will already have been unset via the DestroyAllChannels()
     // call above, which triggers a call to TeardownDataChannelTransport_n().
     // TODO(tommi): ^^ That's not exactly optimal since this is yet another
@@ -1870,7 +1862,7 @@
     }
   });
 
-  worker_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+  worker_thread()->BlockingCall([this] {
     RTC_DCHECK_RUN_ON(worker_thread());
     worker_thread_safety_->SetNotAlive();
     call_.reset();
@@ -2225,11 +2217,10 @@
 
   absl::optional<rtc::SSLRole> dtls_role;
   if (sctp_mid_s_) {
-    dtls_role = network_thread()->Invoke<absl::optional<rtc::SSLRole>>(
-        RTC_FROM_HERE, [this] {
-          RTC_DCHECK_RUN_ON(network_thread());
-          return transport_controller_->GetDtlsRole(*sctp_mid_n_);
-        });
+    dtls_role = network_thread()->BlockingCall([this] {
+      RTC_DCHECK_RUN_ON(network_thread());
+      return transport_controller_->GetDtlsRole(*sctp_mid_n_);
+    });
     if (!dtls_role && sdp_handler_->is_caller().has_value()) {
       // This works fine if we are the offerer, but can be a mistake if
       // we are the answerer and the remote offer is ACTIVE. In that
@@ -2259,11 +2250,10 @@
     return false;
   }
 
-  auto dtls_role = network_thread()->Invoke<absl::optional<rtc::SSLRole>>(
-      RTC_FROM_HERE, [this, content_name]() {
-        RTC_DCHECK_RUN_ON(network_thread());
-        return transport_controller_->GetDtlsRole(content_name);
-      });
+  auto dtls_role = network_thread()->BlockingCall([this, content_name]() {
+    RTC_DCHECK_RUN_ON(network_thread());
+    return transport_controller_->GetDtlsRole(content_name);
+  });
   if (dtls_role) {
     *role = *dtls_role;
     return true;
@@ -2360,7 +2350,7 @@
 }
 
 bool PeerConnection::NeedsIceRestart(const std::string& content_name) const {
-  return network_thread()->Invoke<bool>(RTC_FROM_HERE, [this, &content_name] {
+  return network_thread()->BlockingCall([this, &content_name] {
     RTC_DCHECK_RUN_ON(network_thread());
     return transport_controller_->NeedsIceRestart(content_name);
   });
@@ -2489,8 +2479,7 @@
 
 Call::Stats PeerConnection::GetCallStats() {
   if (!worker_thread()->IsCurrent()) {
-    return worker_thread()->Invoke<Call::Stats>(
-        RTC_FROM_HERE, [this] { return GetCallStats(); });
+    return worker_thread()->BlockingCall([this] { return GetCallStats(); });
   }
   RTC_DCHECK_RUN_ON(worker_thread());
   rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls;
diff --git a/pc/peer_connection_factory.cc b/pc/peer_connection_factory.cc
index 6460a90..cec909f 100644
--- a/pc/peer_connection_factory.cc
+++ b/pc/peer_connection_factory.cc
@@ -46,7 +46,6 @@
 #include "rtc_base/checks.h"
 #include "rtc_base/experiments/field_trial_parser.h"
 #include "rtc_base/experiments/field_trial_units.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/numerics/safe_conversions.h"
 #include "rtc_base/rtc_certificate_generator.h"
@@ -60,12 +59,9 @@
   // The PeerConnectionFactory must be created on the signaling thread.
   if (dependencies.signaling_thread &&
       !dependencies.signaling_thread->IsCurrent()) {
-    return dependencies.signaling_thread
-        ->Invoke<rtc::scoped_refptr<PeerConnectionFactoryInterface>>(
-            RTC_FROM_HERE, [&dependencies] {
-              return CreateModularPeerConnectionFactory(
-                  std::move(dependencies));
-            });
+    return dependencies.signaling_thread->BlockingCall([&dependencies] {
+      return CreateModularPeerConnectionFactory(std::move(dependencies));
+    });
   }
 
   auto pc_factory = PeerConnectionFactory::Create(std::move(dependencies));
@@ -238,13 +234,12 @@
   dependencies.allocator->SetVpnList(configuration.vpn_list);
 
   std::unique_ptr<RtcEventLog> event_log =
-      worker_thread()->Invoke<std::unique_ptr<RtcEventLog>>(
-          RTC_FROM_HERE, [this] { return CreateRtcEventLog_w(); });
+      worker_thread()->BlockingCall([this] { return CreateRtcEventLog_w(); });
 
   const FieldTrialsView* trials =
       dependencies.trials ? dependencies.trials.get() : &field_trials();
-  std::unique_ptr<Call> call = worker_thread()->Invoke<std::unique_ptr<Call>>(
-      RTC_FROM_HERE, [this, &event_log, trials] {
+  std::unique_ptr<Call> call =
+      worker_thread()->BlockingCall([this, &event_log, trials] {
         return CreateCall_w(event_log.get(), *trials);
       });
 
diff --git a/pc/rtc_stats_collector.cc b/pc/rtc_stats_collector.cc
index 15e72c4..c27533a 100644
--- a/pc/rtc_stats_collector.cc
+++ b/pc/rtc_stats_collector.cc
@@ -50,7 +50,6 @@
 #include "pc/webrtc_sdp.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/ip_address.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/network_constants.h"
 #include "rtc_base/rtc_certificate.h"
@@ -2316,9 +2315,9 @@
   auto transceivers = pc_->GetTransceiversInternal();
 
   // TODO(tommi): See if we can avoid synchronously blocking the signaling
-  // thread while we do this (or avoid the Invoke at all).
-  network_thread_->Invoke<void>(RTC_FROM_HERE, [this, &transceivers,
-                                                &voice_stats, &video_stats] {
+  // thread while we do this (or avoid the BlockingCall at all).
+  network_thread_->BlockingCall([this, &transceivers, &voice_stats,
+                                 &video_stats] {
     rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls;
 
     for (const auto& transceiver_proxy : transceivers) {
@@ -2363,7 +2362,7 @@
   // well as GetCallStats(). At the same time we construct the
   // TrackMediaInfoMaps, which also needs info from the worker thread. This
   // minimizes the number of thread jumps.
-  worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
+  worker_thread_->BlockingCall([&] {
     rtc::Thread::ScopedDisallowBlockingCalls no_blocking_calls;
 
     for (auto& pair : voice_stats) {
diff --git a/pc/rtp_sender.cc b/pc/rtp_sender.cc
index b42e439..aa640f3 100644
--- a/pc/rtp_sender.cc
+++ b/pc/rtp_sender.cc
@@ -24,7 +24,6 @@
 #include "pc/legacy_stats_collector_interface.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/helpers.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/trace_event.h"
 
@@ -125,9 +124,8 @@
   frame_encryptor_ = std::move(frame_encryptor);
   // Special Case: Set the frame encryptor to any value on any existing channel.
   if (media_channel_ && ssrc_ && !stopped_) {
-    worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
-      media_channel_->SetFrameEncryptor(ssrc_, frame_encryptor_);
-    });
+    worker_thread_->BlockingCall(
+        [&] { media_channel_->SetFrameEncryptor(ssrc_, frame_encryptor_); });
   }
 }
 
@@ -142,7 +140,7 @@
 void RtpSenderBase::SetEncoderSelectorOnChannel() {
   RTC_DCHECK_RUN_ON(signaling_thread_);
   if (media_channel_ && ssrc_ && !stopped_) {
-    worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
+    worker_thread_->BlockingCall([&] {
       media_channel_->SetEncoderSelector(ssrc_, encoder_selector_.get());
     });
   }
@@ -162,7 +160,7 @@
   if (!media_channel_ || !ssrc_) {
     return init_parameters_;
   }
-  return worker_thread_->Invoke<RtpParameters>(RTC_FROM_HERE, [&] {
+  return worker_thread_->BlockingCall([&] {
     RtpParameters result = media_channel_->GetRtpSendParameters(ssrc_);
     RemoveEncodingLayers(disabled_rids_, &result.encodings);
     return result;
@@ -177,7 +175,7 @@
   if (!media_channel_ || !ssrc_) {
     return init_parameters_;
   }
-  return worker_thread_->Invoke<RtpParameters>(RTC_FROM_HERE, [&] {
+  return worker_thread_->BlockingCall([&] {
     RtpParameters result = media_channel_->GetRtpSendParameters(ssrc_);
     return result;
   });
@@ -208,7 +206,7 @@
     }
     return result;
   }
-  return worker_thread_->Invoke<RTCError>(RTC_FROM_HERE, [&] {
+  return worker_thread_->BlockingCall([&] {
     RtpParameters rtp_parameters = parameters;
     if (!disabled_rids_.empty()) {
       // Need to add the inactive layers.
@@ -239,7 +237,7 @@
     }
     return result;
   }
-  return worker_thread_->Invoke<RTCError>(RTC_FROM_HERE, [&] {
+  return worker_thread_->BlockingCall([&] {
     RtpParameters rtp_parameters = parameters;
     return media_channel_->SetRtpSendParameters(ssrc_, rtp_parameters);
   });
@@ -345,7 +343,7 @@
   }
   if (!init_parameters_.encodings.empty() ||
       init_parameters_.degradation_preference.has_value()) {
-    worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
+    worker_thread_->BlockingCall([&] {
       RTC_DCHECK(media_channel_);
       // Get the current parameters, which are constructed from the SDP.
       // The number of layers in the SDP is currently authoritative to support
@@ -454,7 +452,7 @@
   RTC_DCHECK_RUN_ON(signaling_thread_);
   frame_transformer_ = std::move(frame_transformer);
   if (media_channel_ && ssrc_ && !stopped_) {
-    worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
+    worker_thread_->BlockingCall([&] {
       media_channel_->SetEncoderToPacketizerFrameTransformer(
           ssrc_, frame_transformer_);
     });
@@ -526,8 +524,8 @@
     RTC_LOG(LS_ERROR) << "CanInsertDtmf: Sender does not have SSRC.";
     return false;
   }
-  return worker_thread_->Invoke<bool>(
-      RTC_FROM_HERE, [&] { return voice_media_channel()->CanInsertDtmf(); });
+  return worker_thread_->BlockingCall(
+      [&] { return voice_media_channel()->CanInsertDtmf(); });
 }
 
 bool AudioRtpSender::InsertDtmf(int code, int duration) {
@@ -539,9 +537,8 @@
     RTC_LOG(LS_ERROR) << "InsertDtmf: Sender does not have SSRC.";
     return false;
   }
-  bool success = worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
-    return voice_media_channel()->InsertDtmf(ssrc_, code, duration);
-  });
+  bool success = worker_thread_->BlockingCall(
+      [&] { return voice_media_channel()->InsertDtmf(ssrc_, code, duration); });
   if (!success) {
     RTC_LOG(LS_ERROR) << "Failed to insert DTMF to channel.";
   }
@@ -610,7 +607,7 @@
   // `track_->enabled()` hops to the signaling thread, so call it before we hop
   // to the worker thread or else it will deadlock.
   bool track_enabled = track_->enabled();
-  bool success = worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
+  bool success = worker_thread_->BlockingCall([&] {
     return voice_media_channel()->SetAudioSend(ssrc_, track_enabled, &options,
                                                sink_adapter_.get());
   });
@@ -628,7 +625,7 @@
     return;
   }
   cricket::AudioOptions options;
-  bool success = worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
+  bool success = worker_thread_->BlockingCall([&] {
     return voice_media_channel()->SetAudioSend(ssrc_, false, &options, nullptr);
   });
   if (!success) {
@@ -704,7 +701,7 @@
       options.is_screencast = true;
       break;
   }
-  bool success = worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
+  bool success = worker_thread_->BlockingCall([&] {
     return video_media_channel()->SetVideoSend(ssrc_, &options,
                                                video_track().get());
   });
@@ -722,9 +719,8 @@
   // Allow SetVideoSend to fail since `enable` is false and `source` is null.
   // This the normal case when the underlying media channel has already been
   // deleted.
-  worker_thread_->Invoke<bool>(RTC_FROM_HERE, [&] {
-    return video_media_channel()->SetVideoSend(ssrc_, nullptr, nullptr);
-  });
+  worker_thread_->BlockingCall(
+      [&] { video_media_channel()->SetVideoSend(ssrc_, nullptr, nullptr); });
 }
 
 }  // namespace webrtc
diff --git a/pc/rtp_transceiver.cc b/pc/rtp_transceiver.cc
index 44a96d4..db49468 100644
--- a/pc/rtp_transceiver.cc
+++ b/pc/rtp_transceiver.cc
@@ -28,7 +28,6 @@
 #include "pc/rtp_media_utils.h"
 #include "pc/session_description.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/thread.h"
 
@@ -185,57 +184,42 @@
     // TODO(bugs.webrtc.org/11992): Remove this workaround after updates in
     // PeerConnection and add the expectation that we're already on the right
     // thread.
-    new_channel =
-        context()
-            ->worker_thread()
-            ->Invoke<std::unique_ptr<cricket::VoiceChannel>>(
-                RTC_FROM_HERE, [&]() -> std::unique_ptr<cricket::VoiceChannel> {
-                  RTC_DCHECK_RUN_ON(context()->worker_thread());
+    context()->worker_thread()->BlockingCall([&] {
+      RTC_DCHECK_RUN_ON(context()->worker_thread());
 
-                  cricket::VoiceMediaChannel* media_channel =
-                      media_engine()->voice().CreateMediaChannel(
-                          call_ptr, media_config, audio_options,
-                          crypto_options);
-                  if (!media_channel) {
-                    return nullptr;
-                  }
+      cricket::VoiceMediaChannel* media_channel =
+          media_engine()->voice().CreateMediaChannel(
+              call_ptr, media_config, audio_options, crypto_options);
+      if (!media_channel) {
+        return;
+      }
 
-                  auto voice_channel = std::make_unique<cricket::VoiceChannel>(
-                      context()->worker_thread(), context()->network_thread(),
-                      context()->signaling_thread(),
-                      absl::WrapUnique(media_channel), mid, srtp_required,
-                      crypto_options, context()->ssrc_generator());
-
-                  return voice_channel;
-                });
+      new_channel = std::make_unique<cricket::VoiceChannel>(
+          context()->worker_thread(), context()->network_thread(),
+          context()->signaling_thread(), absl::WrapUnique(media_channel), mid,
+          srtp_required, crypto_options, context()->ssrc_generator());
+    });
   } else {
     RTC_DCHECK_EQ(cricket::MEDIA_TYPE_VIDEO, media_type());
 
     // TODO(bugs.webrtc.org/11992): CreateVideoChannel internally switches to
     // the worker thread. We shouldn't be using the `call_ptr_` hack here but
     // simply be on the worker thread and use `call_` (update upstream code).
-    new_channel =
-        context()
-            ->worker_thread()
-            ->Invoke<std::unique_ptr<cricket::VideoChannel>>(
-                RTC_FROM_HERE, [&]() -> std::unique_ptr<cricket::VideoChannel> {
-                  RTC_DCHECK_RUN_ON(context()->worker_thread());
-                  cricket::VideoMediaChannel* media_channel =
-                      media_engine()->video().CreateMediaChannel(
-                          call_ptr, media_config, video_options, crypto_options,
-                          video_bitrate_allocator_factory);
-                  if (!media_channel) {
-                    return nullptr;
-                  }
+    context()->worker_thread()->BlockingCall([&] {
+      RTC_DCHECK_RUN_ON(context()->worker_thread());
+      cricket::VideoMediaChannel* media_channel =
+          media_engine()->video().CreateMediaChannel(
+              call_ptr, media_config, video_options, crypto_options,
+              video_bitrate_allocator_factory);
+      if (!media_channel) {
+        return;
+      }
 
-                  auto video_channel = std::make_unique<cricket::VideoChannel>(
-                      context()->worker_thread(), context()->network_thread(),
-                      context()->signaling_thread(),
-                      absl::WrapUnique(media_channel), mid, srtp_required,
-                      crypto_options, context()->ssrc_generator());
-
-                  return video_channel;
-                });
+      new_channel = std::make_unique<cricket::VideoChannel>(
+          context()->worker_thread(), context()->network_thread(),
+          context()->signaling_thread(), absl::WrapUnique(media_channel), mid,
+          srtp_required, crypto_options, context()->ssrc_generator());
+    });
   }
   if (!new_channel) {
     // TODO(hta): Must be a better way
@@ -274,7 +258,7 @@
   // Similarly, if the channel() accessor is limited to the network thread, that
   // helps with keeping the channel implementation requirements being met and
   // avoids synchronization for accessing the pointer or network related state.
-  context()->network_thread()->Invoke<void>(RTC_FROM_HERE, [&]() {
+  context()->network_thread()->BlockingCall([&]() {
     if (channel_) {
       channel_->SetFirstPacketReceivedCallback(nullptr);
       channel_->SetRtpTransport(nullptr);
@@ -310,7 +294,7 @@
   }
   std::unique_ptr<cricket::ChannelInterface> channel_to_delete;
 
-  context()->network_thread()->Invoke<void>(RTC_FROM_HERE, [&]() {
+  context()->network_thread()->BlockingCall([&]() {
     if (channel_) {
       channel_->SetFirstPacketReceivedCallback(nullptr);
       channel_->SetRtpTransport(nullptr);
@@ -331,7 +315,7 @@
   if (!channel_to_delete && senders_.empty() && receivers_.empty()) {
     return;
   }
-  context()->worker_thread()->Invoke<void>(RTC_FROM_HERE, [&]() {
+  context()->worker_thread()->BlockingCall([&]() {
     // Push down the new media_channel, if any, otherwise clear it.
     auto* media_channel = channel_ ? channel_->media_channel() : nullptr;
     for (const auto& sender : senders_) {
@@ -399,7 +383,7 @@
   }
 
   (*it)->internal()->Stop();
-  context()->worker_thread()->Invoke<void>(RTC_FROM_HERE, [&]() {
+  context()->worker_thread()->BlockingCall([&]() {
     // `Stop()` will clear the receiver's pointer to the media channel.
     (*it)->internal()->SetMediaChannel(nullptr);
   });
@@ -533,7 +517,7 @@
   for (const auto& receiver : receivers_)
     receiver->internal()->Stop();
 
-  context()->worker_thread()->Invoke<void>(RTC_FROM_HERE, [&]() {
+  context()->worker_thread()->BlockingCall([&]() {
     // 5 Stop receiving media with receiver.
     for (const auto& receiver : receivers_)
       receiver->internal()->SetMediaChannel(nullptr);
diff --git a/pc/sctp_data_channel.cc b/pc/sctp_data_channel.cc
index a5e0d76..0591bcc 100644
--- a/pc/sctp_data_channel.cc
+++ b/pc/sctp_data_channel.cc
@@ -20,7 +20,6 @@
 #include "pc/proxy.h"
 #include "pc/sctp_utils.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/system/unused.h"
 #include "rtc_base/thread.h"
diff --git a/pc/sctp_transport.cc b/pc/sctp_transport.cc
index f411883..eabaa04 100644
--- a/pc/sctp_transport.cc
+++ b/pc/sctp_transport.cc
@@ -17,7 +17,6 @@
 #include "api/dtls_transport_interface.h"
 #include "api/sequence_checker.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 
 namespace webrtc {
@@ -50,8 +49,7 @@
   // expected thread. Chromium currently calls this method from
   // TransceiverStateSurfacer.
   if (!owner_thread_->IsCurrent()) {
-    return owner_thread_->Invoke<SctpTransportInformation>(
-        RTC_FROM_HERE, [this] { return Information(); });
+    return owner_thread_->BlockingCall([this] { return Information(); });
   }
   RTC_DCHECK_RUN_ON(owner_thread_);
   return info_;
diff --git a/pc/sdp_offer_answer.cc b/pc/sdp_offer_answer.cc
index 9a5023c..35e65e0 100644
--- a/pc/sdp_offer_answer.cc
+++ b/pc/sdp_offer_answer.cc
@@ -55,7 +55,6 @@
 #include "pc/usage_pattern.h"
 #include "pc/webrtc_session_description_factory.h"
 #include "rtc_base/helpers.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 #include "rtc_base/rtc_certificate.h"
 #include "rtc_base/ssl_stream_adapter.h"
@@ -691,13 +690,12 @@
     JsepTransportController* controller,
     const std::string& mid) {
   // TODO(tommi): Can we post this (and associated operations where this
-  // function is called) to the network thread and avoid this Invoke?
+  // function is called) to the network thread and avoid this BlockingCall?
   // We might be able to simplify a few things if we set the transport on
   // the network thread and then update the implementation to check that
   // the set_ and relevant get methods are always called on the network
   // thread (we'll need to update proxy maps).
-  return network_thread->Invoke<rtc::scoped_refptr<webrtc::DtlsTransport>>(
-      RTC_FROM_HERE,
+  return network_thread->BlockingCall(
       [controller, &mid] { return controller->LookupDtlsTransportByMid(mid); });
 }
 
@@ -1813,7 +1811,7 @@
   ReportSimulcastApiVersion(kSimulcastVersionApplyRemoteDescription,
                             *session_desc);
 
-  // NOTE: This will perform an Invoke() to the network thread.
+  // NOTE: This will perform a BlockingCall() to the network thread.
   return transport_controller_s()->SetRemoteDescription(sdp_type, session_desc);
 }
 
@@ -2200,8 +2198,8 @@
 
     // TODO(deadbeef): We already had to hop to the network thread for
     // MaybeStartGathering...
-    context_->network_thread()->Invoke<void>(
-        RTC_FROM_HERE, [this] { port_allocator()->DiscardCandidatePool(); });
+    context_->network_thread()->BlockingCall(
+        [this] { port_allocator()->DiscardCandidatePool(); });
     // Make UMA notes about what was agreed to.
     ReportNegotiatedSdpSemantics(*local_description());
   }
@@ -2404,8 +2402,8 @@
   if (was_answer) {
     // TODO(deadbeef): We already had to hop to the network thread for
     // MaybeStartGathering...
-    context_->network_thread()->Invoke<void>(
-        RTC_FROM_HERE, [this] { port_allocator()->DiscardCandidatePool(); });
+    context_->network_thread()->BlockingCall(
+        [this] { port_allocator()->DiscardCandidatePool(); });
     // Make UMA notes about what was agreed to.
     ReportNegotiatedSdpSemantics(*remote_description());
   }
@@ -3831,8 +3829,7 @@
   session_options->rtcp_cname = rtcp_cname_;
   session_options->crypto_options = pc_->GetCryptoOptions();
   session_options->pooled_ice_credentials =
-      context_->network_thread()->Invoke<std::vector<cricket::IceParameters>>(
-          RTC_FROM_HERE,
+      context_->network_thread()->BlockingCall(
           [this] { return port_allocator()->GetPooledIceCredentials(); });
   session_options->offer_extmap_allow_mixed =
       pc_->configuration()->offer_extmap_allow_mixed;
@@ -4095,8 +4092,7 @@
   session_options->rtcp_cname = rtcp_cname_;
   session_options->crypto_options = pc_->GetCryptoOptions();
   session_options->pooled_ice_credentials =
-      context_->network_thread()->Invoke<std::vector<cricket::IceParameters>>(
-          RTC_FROM_HERE,
+      context_->network_thread()->BlockingCall(
           [this] { return port_allocator()->GetPooledIceCredentials(); });
 }
 
@@ -4525,8 +4521,8 @@
   RTC_DCHECK(sdesc);
 
   if (ConfiguredForMedia()) {
-    // Note: This will perform an Invoke over to the worker thread, which we'll
-    // also do in a loop below.
+    // Note: This will perform a BlockingCall over to the worker thread, which
+    // we'll also do in a loop below.
     if (!UpdatePayloadTypeDemuxingState(source, bundle_groups_by_mid)) {
       // Note that this is never expected to fail, since RtpDemuxer doesn't
       // return an error when changing payload type demux criteria, which is all
@@ -4570,7 +4566,7 @@
     for (const auto& entry : channels) {
       std::string error;
       bool success =
-          context_->worker_thread()->Invoke<bool>(RTC_FROM_HERE, [&]() {
+          context_->worker_thread()->BlockingCall([&]() {
             return (source == cricket::CS_LOCAL)
                        ? entry.first->SetLocalContent(entry.second, type, error)
                        : entry.first->SetRemoteContent(entry.second, type,
@@ -4918,7 +4914,7 @@
 
 bool SdpOfferAnswerHandler::CreateDataChannel(const std::string& mid) {
   RTC_DCHECK_RUN_ON(signaling_thread());
-  if (!context_->network_thread()->Invoke<bool>(RTC_FROM_HERE, [this, &mid] {
+  if (!context_->network_thread()->BlockingCall([this, &mid] {
         RTC_DCHECK_RUN_ON(context_->network_thread());
         return pc_->SetupDataChannelTransport_n(mid);
       })) {
@@ -4940,7 +4936,7 @@
   if (has_sctp)
     data_channel_controller()->OnTransportChannelClosed(error);
 
-  context_->network_thread()->Invoke<void>(RTC_FROM_HERE, [this] {
+  context_->network_thread()->BlockingCall([this] {
     RTC_DCHECK_RUN_ON(context_->network_thread());
     pc_->TeardownDataChannelTransport_n();
   });
@@ -5174,7 +5170,7 @@
                                         pt_demuxing_has_been_used_video_;
 
   // Gather all updates ahead of time so that all channels can be updated in a
-  // single Invoke; necessary due to thread guards.
+  // single BlockingCall; necessary due to thread guards.
   std::vector<std::pair<bool, cricket::ChannelInterface*>> channels_to_update;
   for (const auto& transceiver : transceivers()->ListInternal()) {
     cricket::ChannelInterface* channel = transceiver->channel();
@@ -5226,22 +5222,21 @@
     return true;
   }
 
-  // TODO(bugs.webrtc.org/11993): This Invoke() will also invoke on the network
-  // thread for every demuxer sink that needs to be updated. The demuxer state
-  // needs to be fully (and only) managed on the network thread and once that's
-  // the case, there's no need to stop by on the worker. Ideally we could also
-  // do this without blocking.
-  return context_->worker_thread()->Invoke<bool>(
-      RTC_FROM_HERE, [&channels_to_update]() {
-        for (const auto& it : channels_to_update) {
-          if (!it.second->SetPayloadTypeDemuxingEnabled(it.first)) {
-            // Note that the state has already been irrevocably changed at this
-            // point. Is it useful to stop the loop?
-            return false;
-          }
-        }
-        return true;
-      });
+  // TODO(bugs.webrtc.org/11993): This BlockingCall() will also block on the
+  // network thread for every demuxer sink that needs to be updated. The demuxer
+  // state needs to be fully (and only) managed on the network thread and once
+  // that's the case, there's no need to stop by on the worker. Ideally we could
+  // also do this without blocking.
+  return context_->worker_thread()->BlockingCall([&channels_to_update]() {
+    for (const auto& it : channels_to_update) {
+      if (!it.second->SetPayloadTypeDemuxingEnabled(it.first)) {
+        // Note that the state has already been irrevocably changed at this
+        // point. Is it useful to stop the loop?
+        return false;
+      }
+    }
+    return true;
+  });
 }
 
 bool SdpOfferAnswerHandler::ConfiguredForMedia() const {
diff --git a/pc/video_rtp_receiver.cc b/pc/video_rtp_receiver.cc
index d6272e7..e01a33f 100644
--- a/pc/video_rtp_receiver.cc
+++ b/pc/video_rtp_receiver.cc
@@ -19,7 +19,6 @@
 #include "api/video/recordable_encoded_frame.h"
 #include "pc/video_track.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/location.h"
 #include "rtc_base/logging.h"
 
 namespace webrtc {
@@ -117,7 +116,7 @@
   RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
   MediaSourceInterface::SourceState state = source_->state();
   // TODO(tommi): Can we restart the media channel without blocking?
-  worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
+  worker_thread_->BlockingCall([&] {
     RTC_DCHECK_RUN_ON(worker_thread_);
     RestartMediaChannel_w(std::move(ssrc), state);
   });
@@ -316,7 +315,7 @@
   RTC_DCHECK_RUN_ON(&signaling_thread_checker_);
   RTC_DCHECK(media_channel);
   MediaSourceInterface::SourceState state = source_->state();
-  worker_thread_->Invoke<void>(RTC_FROM_HERE, [&] {
+  worker_thread_->BlockingCall([&] {
     RTC_DCHECK_RUN_ON(worker_thread_);
     SetMediaChannel_w(media_channel);
     RestartMediaChannel_w(std::move(ssrc), state);
diff --git a/pc/video_track.cc b/pc/video_track.cc
index c979995..0bf8687 100644
--- a/pc/video_track.cc
+++ b/pc/video_track.cc
@@ -16,7 +16,6 @@
 #include "api/notifier.h"
 #include "api/sequence_checker.h"
 #include "rtc_base/checks.h"
-#include "rtc_base/location.h"
 
 namespace webrtc {
 
@@ -95,7 +94,7 @@
 
   bool ret = MediaStreamTrack<VideoTrackInterface>::set_enabled(enable);
 
-  worker_thread_->Invoke<void>(RTC_FROM_HERE, [&]() {
+  worker_thread_->BlockingCall([&]() {
     RTC_DCHECK_RUN_ON(worker_thread_);
     enabled_w_ = enable;
     for (auto& sink_pair : sink_pairs()) {