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}
This commit is contained in:
Danil Chapovalov
2022-09-08 18:38:10 +02:00
committed by WebRTC LUCI CQ
parent b190ca9e70
commit 9e09a1f327
54 changed files with 209 additions and 320 deletions

View File

@ -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 @@ CreateModularPeerConnectionFactory(
// 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 @@ PeerConnectionFactory::CreatePeerConnectionOrError(
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);
});