Migrate net/dcsctp/ to absl::AnyInvocable based TaskQueueBase interface

Bug: webrtc:14245
Change-Id: Ibf34bdfa1b623c712978728abc4dd821bf2cb089
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/267981
Auto-Submit: Danil Chapovalov <danilchap@webrtc.org>
Commit-Queue: Victor Boivie <boivie@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Victor Boivie <boivie@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37458}
This commit is contained in:
Danil Chapovalov
2022-07-06 11:05:30 +02:00
committed by WebRTC LUCI CQ
parent 25e268ae0f
commit ecf88f4ade
3 changed files with 5 additions and 7 deletions

View File

@ -19,7 +19,6 @@
#include "absl/types/optional.h" #include "absl/types/optional.h"
#include "api/array_view.h" #include "api/array_view.h"
#include "api/task_queue/task_queue_base.h" #include "api/task_queue/task_queue_base.h"
#include "api/task_queue/to_queued_task.h"
#include "api/test/create_network_emulation_manager.h" #include "api/test/create_network_emulation_manager.h"
#include "api/test/network_emulation_manager.h" #include "api/test/network_emulation_manager.h"
#include "api/units/time_delta.h" #include "api/units/time_delta.h"
@ -157,8 +156,7 @@ class SctpActor : public rtc::MessageHandlerAutoCleanup,
emulated_socket.SetReceiver([this](rtc::CopyOnWriteBuffer buf) { emulated_socket.SetReceiver([this](rtc::CopyOnWriteBuffer buf) {
// The receiver will be executed on the NetworkEmulation task queue, but // The receiver will be executed on the NetworkEmulation task queue, but
// the dcSCTP socket is owned by `thread_` and is not thread-safe. // the dcSCTP socket is owned by `thread_` and is not thread-safe.
thread_->PostTask(webrtc::ToQueuedTask( thread_->PostTask([this, buf] { this->sctp_socket_.ReceivePacket(buf); });
[this, buf] { this->sctp_socket_.ReceivePacket(buf); }));
}); });
} }

View File

@ -36,7 +36,7 @@ rtc_library("task_queue_timeout") {
"../../../api:array_view", "../../../api:array_view",
"../../../api/task_queue:pending_task_safety_flag", "../../../api/task_queue:pending_task_safety_flag",
"../../../api/task_queue:task_queue", "../../../api/task_queue:task_queue",
"../../../api/task_queue:to_queued_task", "../../../api/units:time_delta",
"../../../rtc_base:checks", "../../../rtc_base:checks",
"../../../rtc_base:logging", "../../../rtc_base:logging",
"../public:socket", "../public:socket",

View File

@ -10,7 +10,7 @@
#include "net/dcsctp/timer/task_queue_timeout.h" #include "net/dcsctp/timer/task_queue_timeout.h"
#include "api/task_queue/pending_task_safety_flag.h" #include "api/task_queue/pending_task_safety_flag.h"
#include "api/task_queue/to_queued_task.h" #include "api/units/time_delta.h"
#include "rtc_base/logging.h" #include "rtc_base/logging.h"
namespace dcsctp { namespace dcsctp {
@ -58,7 +58,7 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
posted_task_expiration_ = timeout_expiration_; posted_task_expiration_ = timeout_expiration_;
parent_.task_queue_.PostDelayedTaskWithPrecision( parent_.task_queue_.PostDelayedTaskWithPrecision(
precision_, precision_,
webrtc::ToQueuedTask( webrtc::SafeTask(
pending_task_safety_flag_, pending_task_safety_flag_,
[timeout_id, this]() { [timeout_id, this]() {
RTC_DLOG(LS_VERBOSE) << "Timout expired: " << timeout_id.value(); RTC_DLOG(LS_VERBOSE) << "Timout expired: " << timeout_id.value();
@ -86,7 +86,7 @@ void TaskQueueTimeoutFactory::TaskQueueTimeout::Start(DurationMs duration_ms,
} }
} }
}), }),
duration_ms.value()); webrtc::TimeDelta::Millis(duration_ms.value()));
} }
void TaskQueueTimeoutFactory::TaskQueueTimeout::Stop() { void TaskQueueTimeoutFactory::TaskQueueTimeout::Stop() {