mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-12 21:30:45 +01:00
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}
This commit is contained in:
parent
bbff58d935
commit
dcc1534764
20 changed files with 0 additions and 191 deletions
|
@ -1468,7 +1468,6 @@ if (rtc_include_tests) {
|
|||
"../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",
|
||||
|
|
|
@ -159,7 +159,6 @@ if (rtc_include_tests) {
|
|||
":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",
|
||||
]
|
||||
|
|
|
@ -220,7 +220,6 @@ rtc_library("rtp_sender") {
|
|||
"../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_library("call") {
|
|||
"../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",
|
||||
|
|
|
@ -49,7 +49,6 @@ rtc_library("resource_adaptation") {
|
|||
"../../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 @@ if (rtc_include_tests) {
|
|||
"../../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",
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
namespace rtc {
|
||||
struct SentPacket;
|
||||
struct NetworkRoute;
|
||||
class TaskQueue;
|
||||
} // namespace rtc
|
||||
namespace webrtc {
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -80,7 +80,6 @@ rtc_library("common_video") {
|
|||
"../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",
|
||||
|
|
|
@ -106,7 +106,6 @@ rtc_library("rtc_media_base") {
|
|||
"../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 @@ if (rtc_include_tests) {
|
|||
"../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 @@ if (rtc_include_tests) {
|
|||
"../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",
|
||||
|
|
|
@ -289,7 +289,6 @@ rtc_library("audio_device_impl") {
|
|||
"../../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",
|
||||
|
|
|
@ -477,7 +477,6 @@ if (rtc_include_tests) {
|
|||
"../../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",
|
||||
]
|
||||
|
|
|
@ -50,7 +50,6 @@ rtc_library("pacing") {
|
|||
"../../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",
|
||||
|
|
|
@ -2526,7 +2526,6 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||
"../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 @@ if (rtc_include_tests && !build_with_chromium) {
|
|||
"../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",
|
||||
|
|
|
@ -643,23 +643,6 @@ rtc_source_set("type_traits") {
|
|||
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 @@ rtc_library("threading") {
|
|||
":platform_thread_types",
|
||||
":refcount",
|
||||
":rtc_event",
|
||||
":rtc_task_queue",
|
||||
":socket",
|
||||
":socket_address",
|
||||
":socket_server",
|
||||
|
@ -1954,7 +1936,6 @@ if (rtc_include_tests) {
|
|||
":rtc_base_tests_utils",
|
||||
":rtc_event",
|
||||
":rtc_numerics",
|
||||
":rtc_task_queue",
|
||||
":safe_compare",
|
||||
":safe_minmax",
|
||||
":sample_counter",
|
||||
|
|
|
@ -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
|
|
@ -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_
|
|
@ -33,7 +33,6 @@ if (rtc_include_tests) {
|
|||
deps = [
|
||||
":repeating_task",
|
||||
"..:rtc_event",
|
||||
"..:rtc_task_queue",
|
||||
"..:task_queue_for_test",
|
||||
"../../api/task_queue",
|
||||
"../../api/task_queue/test:mock_task_queue_base",
|
||||
|
|
|
@ -52,7 +52,6 @@ if (rtc_enable_protobuf) {
|
|||
"../../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",
|
||||
|
|
|
@ -682,7 +682,6 @@ if (current_os == "linux" || is_android) {
|
|||
"../../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 @@ if (current_os == "linux" || is_android) {
|
|||
"../../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",
|
||||
|
|
Loading…
Reference in a new issue