Remove rtc::Location from SendTask test helper
that rtc::Location parameter was used only as extra information for the
RTC_CHECKs directly in the function, thus call stack of the crash should
provide all the information about the caller.
Bug: webrtc:11318
Change-Id: Iec6dd2c5de547f3e1601647a614be7ce57a55734
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/270920
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37748}
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index d65b4da..ee8d6cd 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -1415,7 +1415,6 @@
]
deps = [
":checks",
- ":location",
":macromagic",
":rtc_event",
":rtc_task_queue",
diff --git a/rtc_base/task_queue_for_test.h b/rtc_base/task_queue_for_test.h
index 450050a..260827f 100644
--- a/rtc_base/task_queue_for_test.h
+++ b/rtc_base/task_queue_for_test.h
@@ -19,23 +19,20 @@
#include "api/task_queue/task_queue_base.h"
#include "rtc_base/checks.h"
#include "rtc_base/event.h"
-#include "rtc_base/location.h"
#include "rtc_base/task_queue.h"
#include "rtc_base/thread_annotations.h"
namespace webrtc {
-inline void SendTask(rtc::Location loc,
- TaskQueueBase* task_queue,
+inline void SendTask(TaskQueueBase* task_queue,
rtc::FunctionView<void()> task) {
RTC_CHECK(!task_queue->IsCurrent())
- << "Called SendTask to a queue from the same queue at " << loc.ToString();
+ << "Called SendTask to a queue from the same queue";
rtc::Event event;
absl::Cleanup cleanup = [&event] { event.Set(); };
task_queue->PostTask([task, cleanup = std::move(cleanup)] { task(); });
RTC_CHECK(event.Wait(/*give_up_after_ms=*/rtc::Event::kForever,
- /*warn_after_ms=*/10'000))
- << "Waited too long at " << loc.ToString();
+ /*warn_after_ms=*/10'000));
}
class RTC_LOCKABLE TaskQueueForTest : public rtc::TaskQueue {
@@ -49,8 +46,8 @@
// A convenience, test-only method that blocks the current thread while
// a task executes on the task queue.
- void SendTask(rtc::FunctionView<void()> task, rtc::Location loc) {
- ::webrtc::SendTask(loc, Get(), task);
+ void SendTask(rtc::FunctionView<void()> task) {
+ ::webrtc::SendTask(Get(), task);
}
// Wait for the completion of all tasks posted prior to the
@@ -58,7 +55,7 @@
void WaitForPreviouslyPostedTasks() {
// Post an empty task on the queue and wait for it to finish, to ensure
// that all already posted tasks on the queue get executed.
- SendTask([]() {}, RTC_FROM_HERE);
+ SendTask([]() {});
}
};
diff --git a/rtc_base/weak_ptr_unittest.cc b/rtc_base/weak_ptr_unittest.cc
index 0757a1d..9e22312 100644
--- a/rtc_base/weak_ptr_unittest.cc
+++ b/rtc_base/weak_ptr_unittest.cc
@@ -204,7 +204,7 @@
std::unique_ptr<T> NewObjectCreatedOnTaskQueue() {
std::unique_ptr<T> obj;
webrtc::TaskQueueForTest queue("NewObjectCreatedOnTaskQueue");
- queue.SendTask([&] { obj = std::make_unique<T>(); }, RTC_FROM_HERE);
+ queue.SendTask([&] { obj = std::make_unique<T>(); });
return obj;
}
@@ -226,13 +226,11 @@
// Create weak ptr on main thread
WeakPtr<Target> weak_ptr = target->factory.GetWeakPtr();
webrtc::TaskQueueForTest queue("queue");
- queue.SendTask(
- [&] {
- // Dereference and invalide weak_ptr on another thread.
- EXPECT_EQ(weak_ptr.get(), target.get());
- target.reset();
- },
- RTC_FROM_HERE);
+ queue.SendTask([&] {
+ // Dereference and invalide weak_ptr on another thread.
+ EXPECT_EQ(weak_ptr.get(), target.get());
+ target.reset();
+ });
}
} // namespace rtc