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/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index c3e4be9..12676a0 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1492,7 +1492,6 @@
":checks",
":gunit_helpers",
":ip_address",
- ":location",
":logging",
":macromagic",
":net_helpers",
@@ -1581,7 +1580,6 @@
":gunit_helpers",
":histogram_percentile_counter",
":ip_address",
- ":location",
":logging",
":macromagic",
":mod_ops",
diff --git a/rtc_base/fake_mdns_responder.h b/rtc_base/fake_mdns_responder.h
index 8be6f1c..706c11b 100644
--- a/rtc_base/fake_mdns_responder.h
+++ b/rtc_base/fake_mdns_responder.h
@@ -17,7 +17,6 @@
#include "absl/strings/string_view.h"
#include "rtc_base/ip_address.h"
-#include "rtc_base/location.h"
#include "rtc_base/mdns_responder_interface.h"
#include "rtc_base/thread.h"
diff --git a/rtc_base/network.cc b/rtc_base/network.cc
index 673a113..ce77cbc 100644
--- a/rtc_base/network.cc
+++ b/rtc_base/network.cc
@@ -1253,7 +1253,7 @@
if (thread_ == nullptr) {
vpn_ = vpn;
} else {
- thread_->Invoke<void>(RTC_FROM_HERE, [this, vpn] { vpn_ = vpn; });
+ thread_->BlockingCall([this, vpn] { vpn_ = vpn; });
}
}
diff --git a/rtc_base/rtc_certificate_generator.cc b/rtc_base/rtc_certificate_generator.cc
index 739890e..bdd90f2 100644
--- a/rtc_base/rtc_certificate_generator.cc
+++ b/rtc_base/rtc_certificate_generator.cc
@@ -17,7 +17,6 @@
#include <utility>
#include "rtc_base/checks.h"
-#include "rtc_base/location.h"
#include "rtc_base/message_handler.h"
#include "rtc_base/ssl_identity.h"
diff --git a/rtc_base/socket_unittest.cc b/rtc_base/socket_unittest.cc
index 2ac5634..ea6407a 100644
--- a/rtc_base/socket_unittest.cc
+++ b/rtc_base/socket_unittest.cc
@@ -23,7 +23,6 @@
#include "rtc_base/async_udp_socket.h"
#include "rtc_base/buffer.h"
#include "rtc_base/gunit.h"
-#include "rtc_base/location.h"
#include "rtc_base/logging.h"
#include "rtc_base/net_helpers.h"
#include "rtc_base/socket_address.h"
@@ -730,7 +729,7 @@
// Shouldn't signal when blocked in a thread Send, where process_io is false.
std::unique_ptr<Thread> thread(Thread::CreateWithSocketServer());
thread->Start();
- thread->Invoke<void>(RTC_FROM_HERE, [] { Thread::SleepMs(500); });
+ thread->BlockingCall([] { Thread::SleepMs(500); });
EXPECT_FALSE(sink.Check(accepted.get(), SSE_READ));
// But should signal when process_io is true.
diff --git a/rtc_base/stream.cc b/rtc_base/stream.cc
index 30c7678..e1aab8c 100644
--- a/rtc_base/stream.cc
+++ b/rtc_base/stream.cc
@@ -16,7 +16,6 @@
#include <string>
#include "rtc_base/checks.h"
-#include "rtc_base/location.h"
#include "rtc_base/thread.h"
namespace rtc {
diff --git a/rtc_base/synchronization/BUILD.gn b/rtc_base/synchronization/BUILD.gn
index 5890e75..5f2b04e 100644
--- a/rtc_base/synchronization/BUILD.gn
+++ b/rtc_base/synchronization/BUILD.gn
@@ -86,7 +86,6 @@
":yield",
":yield_policy",
"..:checks",
- "..:location",
"..:macromagic",
"..:platform_thread",
"..:rtc_base",
diff --git a/rtc_base/task_queue.h b/rtc_base/task_queue.h
index 0ef0ffe..cae9534 100644
--- a/rtc_base/task_queue.h
+++ b/rtc_base/task_queue.h
@@ -90,7 +90,6 @@
// Returns non-owning pointer to the task queue implementation.
webrtc::TaskQueueBase* Get() { return impl_; }
- // TODO(tommi): For better debuggability, implement RTC_FROM_HERE.
void PostTask(absl::AnyInvocable<void() &&> task) {
impl_->PostTask(std::move(task));
}
diff --git a/rtc_base/thread.h b/rtc_base/thread.h
index ad286a8..435aff6 100644
--- a/rtc_base/thread.h
+++ b/rtc_base/thread.h
@@ -349,7 +349,8 @@
// Deprecated, use `BlockingCall` instead.
template <typename ReturnT>
- ReturnT Invoke(const Location& posted_from, FunctionView<ReturnT()> functor) {
+ [[deprecated]] ReturnT Invoke(const Location& /*posted_from*/,
+ FunctionView<ReturnT()> functor) {
return BlockingCall(functor);
}
diff --git a/rtc_base/time_utils_unittest.cc b/rtc_base/time_utils_unittest.cc
index 7e72c5f..2c73b0f 100644
--- a/rtc_base/time_utils_unittest.cc
+++ b/rtc_base/time_utils_unittest.cc
@@ -16,7 +16,6 @@
#include "rtc_base/event.h"
#include "rtc_base/fake_clock.h"
#include "rtc_base/helpers.h"
-#include "rtc_base/location.h"
#include "rtc_base/message_handler.h"
#include "rtc_base/thread.h"
#include "test/gtest.h"