Delete rtc::TaskQueue

All usage was updated to use TaskQueueBase interface directly bypassing rtc::TaskQueue wrapper

Bug: webrtc:14169
Change-Id: I1808afd363b50448d4014d8d8402fce41b16a3ff
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/341082
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#41834}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 9ced1f2..bee98fe 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -1468,7 +1468,6 @@
       "../rtc_base:gunit_helpers",
       "../rtc_base:platform_thread",
       "../rtc_base:rtc_event",
-      "../rtc_base:rtc_task_queue",
       "../rtc_base:ssl",
       "../rtc_base:task_queue_for_test",
       "../rtc_base/containers:flat_set",
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 1b9425d..d2e96de 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -159,7 +159,6 @@
       ":pending_task_safety_flag",
       "../../rtc_base:logging",
       "../../rtc_base:rtc_event",
-      "../../rtc_base:rtc_task_queue",
       "../../rtc_base:task_queue_for_test",
       "../../test:test_support",
     ]
diff --git a/call/BUILD.gn b/call/BUILD.gn
index 613b2b9..85c3332 100644
--- a/call/BUILD.gn
+++ b/call/BUILD.gn
@@ -220,7 +220,6 @@
     "../rtc_base:race_checker",
     "../rtc_base:random",
     "../rtc_base:rate_limiter",
-    "../rtc_base:rtc_task_queue",
     "../rtc_base:timeutils",
     "../rtc_base/synchronization:mutex",
     "../rtc_base/task_utils:repeating_task",
@@ -326,7 +325,6 @@
     "../rtc_base:macromagic",
     "../rtc_base:rate_limiter",
     "../rtc_base:rtc_event",
-    "../rtc_base:rtc_task_queue",
     "../rtc_base:safe_minmax",
     "../rtc_base:stringutils",
     "../rtc_base:threading",
diff --git a/call/adaptation/BUILD.gn b/call/adaptation/BUILD.gn
index b69196f..dd44d1c 100644
--- a/call/adaptation/BUILD.gn
+++ b/call/adaptation/BUILD.gn
@@ -49,7 +49,6 @@
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
     "../../rtc_base:refcount",
-    "../../rtc_base:rtc_task_queue",
     "../../rtc_base:safe_conversions",
     "../../rtc_base:stringutils",
     "../../rtc_base/experiments:balanced_degradation_settings",
@@ -90,7 +89,6 @@
       "../../rtc_base:checks",
       "../../rtc_base:gunit_helpers",
       "../../rtc_base:rtc_event",
-      "../../rtc_base:rtc_task_queue",
       "../../rtc_base:stringutils",
       "../../rtc_base:task_queue_for_test",
       "../../rtc_base/synchronization:mutex",
diff --git a/call/degraded_call.h b/call/degraded_call.h
index 14892f0..b345ba9 100644
--- a/call/degraded_call.h
+++ b/call/degraded_call.h
@@ -39,7 +39,6 @@
 #include "call/video_send_stream.h"
 #include "rtc_base/copy_on_write_buffer.h"
 #include "rtc_base/network/sent_packet.h"
-#include "rtc_base/task_queue.h"
 #include "system_wrappers/include/clock.h"
 #include "video/config/video_encoder_config.h"
 
diff --git a/call/rtp_transport_controller_send.h b/call/rtp_transport_controller_send.h
index 4428336..1438d82 100644
--- a/call/rtp_transport_controller_send.h
+++ b/call/rtp_transport_controller_send.h
@@ -38,7 +38,6 @@
 #include "modules/rtp_rtcp/include/rtp_rtcp_defines.h"
 #include "rtc_base/network_route.h"
 #include "rtc_base/race_checker.h"
-#include "rtc_base/task_queue.h"
 #include "rtc_base/task_utils/repeating_task.h"
 
 namespace webrtc {
diff --git a/call/rtp_transport_controller_send_interface.h b/call/rtp_transport_controller_send_interface.h
index c4b1536..0cc8bb7 100644
--- a/call/rtp_transport_controller_send_interface.h
+++ b/call/rtp_transport_controller_send_interface.h
@@ -38,7 +38,6 @@
 namespace rtc {
 struct SentPacket;
 struct NetworkRoute;
-class TaskQueue;
 }  // namespace rtc
 namespace webrtc {
 
diff --git a/call/rtp_video_sender.cc b/call/rtp_video_sender.cc
index 5808503..c49d82b 100644
--- a/call/rtp_video_sender.cc
+++ b/call/rtp_video_sender.cc
@@ -31,7 +31,6 @@
 #include "modules/video_coding/include/video_codec_interface.h"
 #include "rtc_base/checks.h"
 #include "rtc_base/logging.h"
-#include "rtc_base/task_queue.h"
 #include "rtc_base/trace_event.h"
 
 namespace webrtc {
diff --git a/common_video/BUILD.gn b/common_video/BUILD.gn
index 4736aa5..635e206 100644
--- a/common_video/BUILD.gn
+++ b/common_video/BUILD.gn
@@ -80,7 +80,6 @@
     "../rtc_base:race_checker",
     "../rtc_base:rate_statistics",
     "../rtc_base:refcount",
-    "../rtc_base:rtc_task_queue",
     "../rtc_base:safe_minmax",
     "../rtc_base:timeutils",
     "../rtc_base/synchronization:mutex",
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 4a3b018..ab1999a 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -106,7 +106,6 @@
     "../rtc_base:logging",
     "../rtc_base:macromagic",
     "../rtc_base:network_route",
-    "../rtc_base:rtc_task_queue",
     "../rtc_base:sanitizer",
     "../rtc_base:socket",
     "../rtc_base:stringutils",
@@ -716,7 +715,6 @@
       "../rtc_base:macromagic",
       "../rtc_base:network_route",
       "../rtc_base:rtc_event",
-      "../rtc_base:rtc_task_queue",
       "../rtc_base:stringutils",
       "../rtc_base:threading",
       "../rtc_base:timeutils",
@@ -852,7 +850,6 @@
         "../rtc_base:macromagic",
         "../rtc_base:rtc_base_tests_utils",
         "../rtc_base:rtc_event",
-        "../rtc_base:rtc_task_queue",
         "../rtc_base:safe_conversions",
         "../rtc_base:stringutils",
         "../rtc_base:threading",
diff --git a/modules/audio_device/BUILD.gn b/modules/audio_device/BUILD.gn
index e5f8463..359867e 100644
--- a/modules/audio_device/BUILD.gn
+++ b/modules/audio_device/BUILD.gn
@@ -289,7 +289,6 @@
     "../../rtc_base:platform_thread",
     "../../rtc_base:random",
     "../../rtc_base:rtc_event",
-    "../../rtc_base:rtc_task_queue",
     "../../rtc_base:safe_conversions",
     "../../rtc_base:stringutils",
     "../../rtc_base:timeutils",
diff --git a/modules/audio_processing/BUILD.gn b/modules/audio_processing/BUILD.gn
index 817a351..ba9ec95 100644
--- a/modules/audio_processing/BUILD.gn
+++ b/modules/audio_processing/BUILD.gn
@@ -477,7 +477,6 @@
           "../../api/audio:audio_frame_api",
           "../../api/audio:echo_control",
           "../../rtc_base:rtc_base_tests_utils",
-          "../../rtc_base:rtc_task_queue",
           "aec_dump",
           "aec_dump:aec_dump_unittests",
         ]
diff --git a/modules/pacing/BUILD.gn b/modules/pacing/BUILD.gn
index 8749881..796f19e 100644
--- a/modules/pacing/BUILD.gn
+++ b/modules/pacing/BUILD.gn
@@ -50,7 +50,6 @@
     "../../rtc_base:logging",
     "../../rtc_base:macromagic",
     "../../rtc_base:rtc_numerics",
-    "../../rtc_base:rtc_task_queue",
     "../../rtc_base:timeutils",
     "../../rtc_base/experiments:field_trial_parser",
     "../../rtc_base/synchronization:mutex",
diff --git a/pc/BUILD.gn b/pc/BUILD.gn
index f23a27e..9ff92b4 100644
--- a/pc/BUILD.gn
+++ b/pc/BUILD.gn
@@ -2526,7 +2526,6 @@
       "../modules/audio_processing:api",
       "../p2p:p2p_test_utils",
       "../p2p:rtc_p2p",
-      "../rtc_base:rtc_task_queue",
       "../rtc_base:safe_conversions",
       "../test:audio_codec_mocks",
       "../test:test_main",
@@ -2814,7 +2813,6 @@
       "../rtc_base:logging",
       "../rtc_base:macromagic",
       "../rtc_base:rtc_certificate_generator",
-      "../rtc_base:rtc_task_queue",
       "../rtc_base:ssl",
       "../rtc_base:stringutils",
       "../rtc_base:task_queue_for_test",
diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn
index 4a0427b..775b910 100644
--- a/rtc_base/BUILD.gn
+++ b/rtc_base/BUILD.gn
@@ -643,23 +643,6 @@
   sources = [ "type_traits.h" ]
 }
 
-rtc_library("rtc_task_queue") {
-  visibility = [ "*" ]
-  sources = [
-    "task_queue.cc",
-    "task_queue.h",
-  ]
-  deps = [
-    ":macromagic",
-    "../api/task_queue",
-    "system:rtc_export",
-  ]
-  absl_deps = [
-    "//third_party/abseil-cpp/absl/functional:any_invocable",
-    "//third_party/abseil-cpp/absl/memory",
-  ]
-}
-
 rtc_source_set("rtc_operations_chain") {
   visibility = [ "*" ]
   sources = [
@@ -1049,7 +1032,6 @@
     ":platform_thread_types",
     ":refcount",
     ":rtc_event",
-    ":rtc_task_queue",
     ":socket",
     ":socket_address",
     ":socket_server",
@@ -1954,7 +1936,6 @@
         ":rtc_base_tests_utils",
         ":rtc_event",
         ":rtc_numerics",
-        ":rtc_task_queue",
         ":safe_compare",
         ":safe_minmax",
         ":sample_counter",
diff --git a/rtc_base/task_queue.cc b/rtc_base/task_queue.cc
deleted file mode 100644
index 7c972ed..0000000
--- a/rtc_base/task_queue.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  Copyright 2019 The WebRTC Project Authors. All rights reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-#include "rtc_base/task_queue.h"
-
-#include "api/task_queue/task_queue_base.h"
-
-namespace rtc {
-
-TaskQueue::TaskQueue(
-    std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter> task_queue)
-    : impl_(task_queue.release()) {}
-
-TaskQueue::~TaskQueue() {
-  // There might running task that tries to rescheduler itself to the TaskQueue
-  // and not yet aware TaskQueue destructor is called.
-  // Calling back to TaskQueue::PostTask need impl_ pointer still be valid, so
-  // do not invalidate impl_ pointer until Delete returns.
-  impl_->Delete();
-}
-
-bool TaskQueue::IsCurrent() const {
-  return impl_->IsCurrent();
-}
-
-}  // namespace rtc
diff --git a/rtc_base/task_queue.h b/rtc_base/task_queue.h
deleted file mode 100644
index e52c49c..0000000
--- a/rtc_base/task_queue.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *  Copyright 2016 The WebRTC Project Authors. All rights reserved.
- *
- *  Use of this source code is governed by a BSD-style license
- *  that can be found in the LICENSE file in the root of the source
- *  tree. An additional intellectual property rights grant can be found
- *  in the file PATENTS.  All contributing project authors may
- *  be found in the AUTHORS file in the root of the source tree.
- */
-
-#ifndef RTC_BASE_TASK_QUEUE_H_
-#define RTC_BASE_TASK_QUEUE_H_
-
-#include <stdint.h>
-
-#include <memory>
-#include <utility>
-
-#include "absl/functional/any_invocable.h"
-#include "absl/memory/memory.h"
-#include "api/task_queue/task_queue_base.h"
-#include "api/task_queue/task_queue_factory.h"
-#include "rtc_base/system/rtc_export.h"
-#include "rtc_base/thread_annotations.h"
-
-namespace rtc {
-// Implements a task queue that asynchronously executes tasks in a way that
-// guarantees that they're executed in FIFO order and that tasks never overlap.
-// Tasks may always execute on the same worker thread and they may not.
-// To DCHECK that tasks are executing on a known task queue, use IsCurrent().
-//
-// Here are some usage examples:
-//
-//   1) Asynchronously running a lambda:
-//
-//     class MyClass {
-//       ...
-//       TaskQueue queue_("MyQueue");
-//     };
-//
-//     void MyClass::StartWork() {
-//       queue_.PostTask([]() { Work(); });
-//     ...
-//
-//   2) Posting a custom task on a timer.  The task posts itself again after
-//      every running:
-//
-//     class TimerTask : public QueuedTask {
-//      public:
-//       TimerTask() {}
-//      private:
-//       bool Run() override {
-//         ++count_;
-//         TaskQueueBase::Current()->PostDelayedTask(
-//             absl::WrapUnique(this), 1000);
-//         // Ownership has been transferred to the next occurance,
-//         // so return false to prevent from being deleted now.
-//         return false;
-//       }
-//       int count_ = 0;
-//     };
-//     ...
-//     queue_.PostDelayedTask(std::make_unique<TimerTask>(), 1000);
-//
-// For more examples, see task_queue_unittests.cc.
-//
-// A note on destruction:
-//
-// When a TaskQueue is deleted, pending tasks will not be executed but they will
-// be deleted.  The deletion of tasks may happen asynchronously after the
-// TaskQueue itself has been deleted or it may happen synchronously while the
-// TaskQueue instance is being deleted.  This may vary from one OS to the next
-// so assumptions about lifetimes of pending tasks should not be made.
-class RTC_LOCKABLE RTC_EXPORT TaskQueue {
- public:
-  // TaskQueue priority levels. On some platforms these will map to thread
-  // priorities, on others such as Mac and iOS, GCD queue priorities.
-  using Priority = ::webrtc::TaskQueueFactory::Priority;
-
-  explicit TaskQueue(std::unique_ptr<webrtc::TaskQueueBase,
-                                     webrtc::TaskQueueDeleter> task_queue);
-  ~TaskQueue();
-
-  TaskQueue(const TaskQueue&) = delete;
-  TaskQueue& operator=(const TaskQueue&) = delete;
-
-  // Used for DCHECKing the current queue.
-  bool IsCurrent() const;
-
-  // Returns non-owning pointer to the task queue implementation.
-  webrtc::TaskQueueBase* Get() { return impl_; }
-
-  void PostTask(
-      absl::AnyInvocable<void() &&> task,
-      const webrtc::Location& location = webrtc::Location::Current()) {
-    impl_->PostTask(std::move(task), location);
-  }
-  void PostDelayedTask(
-      absl::AnyInvocable<void() &&> task,
-      webrtc::TimeDelta delay,
-      const webrtc::Location& location = webrtc::Location::Current()) {
-    impl_->PostDelayedTask(std::move(task), delay, location);
-  }
-  void PostDelayedHighPrecisionTask(
-      absl::AnyInvocable<void() &&> task,
-      webrtc::TimeDelta delay,
-      const webrtc::Location& location = webrtc::Location::Current()) {
-    impl_->PostDelayedHighPrecisionTask(std::move(task), delay, location);
-  }
-
- private:
-  webrtc::TaskQueueBase* const impl_;
-};
-
-}  // namespace rtc
-
-#endif  // RTC_BASE_TASK_QUEUE_H_
diff --git a/rtc_base/task_utils/BUILD.gn b/rtc_base/task_utils/BUILD.gn
index c81232c..a2a3e65 100644
--- a/rtc_base/task_utils/BUILD.gn
+++ b/rtc_base/task_utils/BUILD.gn
@@ -33,7 +33,6 @@
     deps = [
       ":repeating_task",
       "..:rtc_event",
-      "..:rtc_task_queue",
       "..:task_queue_for_test",
       "../../api/task_queue",
       "../../api/task_queue/test:mock_task_queue_base",
diff --git a/rtc_tools/network_tester/BUILD.gn b/rtc_tools/network_tester/BUILD.gn
index da62266..b620385 100644
--- a/rtc_tools/network_tester/BUILD.gn
+++ b/rtc_tools/network_tester/BUILD.gn
@@ -52,7 +52,6 @@
       "../../rtc_base:logging",
       "../../rtc_base:macromagic",
       "../../rtc_base:protobuf_utils",
-      "../../rtc_base:rtc_task_queue",
       "../../rtc_base:socket_address",
       "../../rtc_base:socket_server",
       "../../rtc_base:threading",
diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn
index 87e76235..89a78b5 100644
--- a/sdk/android/BUILD.gn
+++ b/sdk/android/BUILD.gn
@@ -682,7 +682,6 @@
       "../../rtc_base:logging",
       "../../rtc_base:race_checker",
       "../../rtc_base:refcount",
-      "../../rtc_base:rtc_task_queue",
       "../../rtc_base:safe_conversions",
       "../../rtc_base:threading",
       "../../rtc_base:timestamp_aligner",
@@ -801,7 +800,6 @@
       "../../rtc_base:logging",
       "../../rtc_base:refcount",
       "../../rtc_base:rtc_certificate_generator",
-      "../../rtc_base:rtc_task_queue",
       "../../rtc_base:safe_conversions",
       "../../rtc_base:ssl",
       "../../rtc_base:stringutils",