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

@ -60,7 +60,6 @@ if (rtc_include_tests) {
"../../api:time_controller",
"../../api/units:time_delta",
"../../rtc_base",
"../../rtc_base:location",
"../../rtc_base:macromagic",
"../../rtc_base:rtc_event",
"../../rtc_base:rtc_task_queue",

View File

@ -14,7 +14,6 @@
#include "api/test/time_controller.h"
#include "api/units/time_delta.h"
#include "rtc_base/event.h"
#include "rtc_base/location.h"
#include "rtc_base/synchronization/mutex.h"
#include "rtc_base/thread.h"
#include "rtc_base/thread_annotations.h"
@ -121,7 +120,7 @@ TEST_P(SimulatedRealTimeControllerConformanceTest, ThreadPostInvokeOrderTest) {
// posted/invoked.
ExecutionOrderKeeper execution_order;
thread->PostTask([&]() { execution_order.Executed(1); });
thread->Invoke<void>(RTC_FROM_HERE, [&]() { execution_order.Executed(2); });
thread->BlockingCall([&]() { execution_order.Executed(2); });
time_controller->AdvanceTime(TimeDelta::Millis(100));
EXPECT_THAT(execution_order.order(), ElementsAreArray({1, 2}));
// Destroy `thread` before `execution_order` to be sure `execution_order`
@ -140,7 +139,7 @@ TEST_P(SimulatedRealTimeControllerConformanceTest,
ExecutionOrderKeeper execution_order;
thread->PostTask([&]() {
thread->PostTask([&]() { execution_order.Executed(2); });
thread->Invoke<void>(RTC_FROM_HERE, [&]() { execution_order.Executed(1); });
thread->BlockingCall([&]() { execution_order.Executed(1); });
});
time_controller->AdvanceTime(TimeDelta::Millis(100));
EXPECT_THAT(execution_order.order(), ElementsAreArray({1, 2}));