Delete static method TaskQueue::IsCurrent.
The static method takes a queue name as argument. Used only in one
place, a DCHECK in IncomingVideoStream, which is converted to use
the non-static version of IsCurrent.
BUG=webrtc:8166
Review-Url: https://codereview.webrtc.org/3004873002
Cr-Original-Commit-Position: refs/heads/master@{#19657}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: 2c7b7a633f6a6aef4467cc3b35a056a4dcc9d619
diff --git a/common_video/incoming_video_stream.cc b/common_video/incoming_video_stream.cc
index be16cfb..b1c3191 100644
--- a/common_video/incoming_video_stream.cc
+++ b/common_video/incoming_video_stream.cc
@@ -37,7 +37,7 @@
private:
bool Run() override {
- RTC_DCHECK(rtc::TaskQueue::IsCurrent(kIncomingQueueName));
+ RTC_DCHECK(stream_->incoming_render_queue_.IsCurrent());
if (stream_->render_buffers_.AddFrame(std::move(frame_)) == 1)
stream_->Dequeue();
return true;
diff --git a/rtc_base/task_queue.h b/rtc_base/task_queue.h
index 0d9630b..5dee6e6 100644
--- a/rtc_base/task_queue.h
+++ b/rtc_base/task_queue.h
@@ -170,7 +170,6 @@
static TaskQueue* Current();
// Used for DCHECKing the current queue.
- static bool IsCurrent(const char* queue_name);
bool IsCurrent() const;
// TODO(tommi): For better debuggability, implement RTC_FROM_HERE.
diff --git a/rtc_base/task_queue_gcd.cc b/rtc_base/task_queue_gcd.cc
index 45c5f09..4094dd5 100644
--- a/rtc_base/task_queue_gcd.cc
+++ b/rtc_base/task_queue_gcd.cc
@@ -145,13 +145,6 @@
return static_cast<TaskQueue*>(pthread_getspecific(GetQueuePtrTls()));
}
-// static
-bool TaskQueue::IsCurrent(const char* queue_name) {
- TaskQueue* current = Current();
- return current &&
- strcmp(queue_name, dispatch_queue_get_label(current->queue_)) == 0;
-}
-
bool TaskQueue::IsCurrent() const {
RTC_DCHECK(queue_);
return this == Current();
diff --git a/rtc_base/task_queue_libevent.cc b/rtc_base/task_queue_libevent.cc
index 99b88df..2c60e9e 100644
--- a/rtc_base/task_queue_libevent.cc
+++ b/rtc_base/task_queue_libevent.cc
@@ -119,7 +119,6 @@
static TaskQueue* CurrentQueue();
// Used for DCHECKing the current queue.
- static bool IsCurrent(const char* queue_name);
bool IsCurrent() const;
void PostTask(std::unique_ptr<QueuedTask> task);
@@ -337,12 +336,6 @@
return nullptr;
}
-// static
-bool TaskQueue::Impl::IsCurrent(const char* queue_name) {
- TaskQueue::Impl* current = Current();
- return current && current->thread_.name().compare(queue_name) == 0;
-}
-
bool TaskQueue::Impl::IsCurrent() const {
return IsThreadRefEqual(thread_.GetThreadRef(), CurrentThreadRef());
}
@@ -503,11 +496,6 @@
}
// Used for DCHECKing the current queue.
-// static
-bool TaskQueue::IsCurrent(const char* queue_name) {
- return TaskQueue::Impl::IsCurrent(queue_name);
-}
-
bool TaskQueue::IsCurrent() const {
return impl_->IsCurrent();
}
diff --git a/rtc_base/task_queue_unittest.cc b/rtc_base/task_queue_unittest.cc
index fbaf6d5..512c4ee 100644
--- a/rtc_base/task_queue_unittest.cc
+++ b/rtc_base/task_queue_unittest.cc
@@ -47,8 +47,7 @@
}
namespace {
-void CheckCurrent(const char* expected_queue, Event* signal, TaskQueue* queue) {
- EXPECT_TRUE(TaskQueue::IsCurrent(expected_queue));
+void CheckCurrent(Event* signal, TaskQueue* queue) {
EXPECT_TRUE(queue->IsCurrent());
if (signal)
signal->Set();
@@ -71,7 +70,7 @@
EXPECT_FALSE(queue.IsCurrent());
EXPECT_FALSE(TaskQueue::Current());
- queue.PostTask(Bind(&CheckCurrent, kQueueName, &event, &queue));
+ queue.PostTask(Bind(&CheckCurrent, &event, &queue));
EXPECT_TRUE(event.Wait(1000));
}
@@ -132,7 +131,7 @@
TaskQueue queue(kQueueName, TaskQueue::Priority::HIGH);
uint32_t start = Time();
- queue.PostDelayedTask(Bind(&CheckCurrent, kQueueName, &event, &queue), 100);
+ queue.PostDelayedTask(Bind(&CheckCurrent, &event, &queue), 100);
EXPECT_TRUE(event.Wait(1000));
uint32_t end = Time();
// These tests are a little relaxed due to how "powerful" our test bots can
@@ -152,7 +151,7 @@
TaskQueue queue(kQueueName, TaskQueue::Priority::HIGH);
uint32_t start = Time();
- queue.PostDelayedTask(Bind(&CheckCurrent, kQueueName, &event, &queue), 3);
+ queue.PostDelayedTask(Bind(&CheckCurrent, &event, &queue), 3);
EXPECT_TRUE(event.Wait(1000));
uint32_t end = TimeMillis();
// These tests are a little relaxed due to how "powerful" our test bots can
@@ -170,7 +169,7 @@
for (int i = 0; i < 100; ++i) {
events.push_back(std::unique_ptr<Event>(new Event(false, false)));
queue.PostDelayedTask(
- Bind(&CheckCurrent, kQueueName, events.back().get(), &queue), i);
+ Bind(&CheckCurrent, events.back().get(), &queue), i);
}
for (const auto& e : events)
@@ -182,7 +181,7 @@
Event event(false, false);
{
TaskQueue queue(kQueueName);
- queue.PostDelayedTask(Bind(&CheckCurrent, kQueueName, &event, &queue), 100);
+ queue.PostDelayedTask(Bind(&CheckCurrent, &event, &queue), 100);
}
EXPECT_FALSE(event.Wait(200)); // Task should not run.
}
@@ -195,8 +194,8 @@
TaskQueue reply_queue(kReplyQueue);
post_queue.PostTaskAndReply(
- Bind(&CheckCurrent, kPostQueue, nullptr, &post_queue),
- Bind(&CheckCurrent, kReplyQueue, &event, &reply_queue), &reply_queue);
+ Bind(&CheckCurrent, nullptr, &post_queue),
+ Bind(&CheckCurrent, &event, &reply_queue), &reply_queue);
EXPECT_TRUE(event.Wait(1000));
}
@@ -277,11 +276,10 @@
}
void TestPostTaskAndReply(TaskQueue* work_queue,
- const char* work_queue_name,
Event* event) {
ASSERT_FALSE(work_queue->IsCurrent());
work_queue->PostTaskAndReply(
- Bind(&CheckCurrent, work_queue_name, nullptr, work_queue),
+ Bind(&CheckCurrent, nullptr, work_queue),
NewClosure([event]() { event->Set(); }));
}
@@ -295,7 +293,7 @@
TaskQueue work_queue(kWorkQueueName);
queue.PostTask(
- Bind(&TestPostTaskAndReply, &work_queue, kWorkQueueName, &event));
+ Bind(&TestPostTaskAndReply, &work_queue, &event));
EXPECT_TRUE(event.Wait(1000));
}
diff --git a/rtc_base/task_queue_win.cc b/rtc_base/task_queue_win.cc
index 128a98f..9b4d1a2 100644
--- a/rtc_base/task_queue_win.cc
+++ b/rtc_base/task_queue_win.cc
@@ -217,12 +217,6 @@
return static_cast<TaskQueue*>(::TlsGetValue(GetQueuePtrTls()));
}
-// static
-bool TaskQueue::IsCurrent(const char* queue_name) {
- TaskQueue* current = Current();
- return current && current->thread_.name().compare(queue_name) == 0;
-}
-
bool TaskQueue::IsCurrent() const {
return IsThreadRefEqual(thread_.GetThreadRef(), CurrentThreadRef());
}