Migrate remaining webrtc usage of TaskQueueBase to absl::AnyInvocable

Bug: webrtc:14245
Change-Id: I8de2c23da5fbdfc0b1efbbe07fb6e8de744424a3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/268191
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#37565}
This commit is contained in:
Danil Chapovalov
2022-07-19 13:07:12 +02:00
committed by WebRTC LUCI CQ
parent 489f648ea3
commit c05a1be5b4
37 changed files with 85 additions and 140 deletions

View File

@ -1563,7 +1563,6 @@ if (is_ios || is_mac) {
"../api:field_trials_view",
"../api:sequence_checker",
"../api/task_queue:pending_task_safety_flag",
"../api/task_queue:to_queued_task",
"../rtc_base",
"../rtc_base:logging",
"../rtc_base:macromagic",

View File

@ -583,7 +583,6 @@ if (current_os == "linux" || is_android) {
"../../api:scoped_refptr",
"../../api:sequence_checker",
"../../api/task_queue:pending_task_safety_flag",
"../../api/task_queue:to_queued_task",
"../../rtc_base",
"../../rtc_base:checks",
"../../rtc_base:ip_address",
@ -675,7 +674,6 @@ if (current_os == "linux" || is_android) {
"../../api:media_stream_interface",
"../../api:sequence_checker",
"../../api/task_queue",
"../../api/task_queue:to_queued_task",
"../../api/video:encoded_image",
"../../api/video:render_resolution",
"../../api/video:video_frame",

View File

@ -19,7 +19,6 @@
#endif
#include "api/sequence_checker.h"
#include "api/task_queue/to_queued_task.h"
#include "rtc_base/checks.h"
#include "rtc_base/ip_address.h"
#include "rtc_base/logging.h"
@ -631,7 +630,7 @@ AndroidNetworkMonitorFactory::CreateNetworkMonitor(
void AndroidNetworkMonitor::NotifyConnectionTypeChanged(
JNIEnv* env,
const JavaRef<jobject>& j_caller) {
network_thread_->PostTask(ToQueuedTask(safety_flag_, [this] {
network_thread_->PostTask(SafeTask(safety_flag_, [this] {
RTC_LOG(LS_INFO)
<< "Android network monitor detected connection type change.";
InvokeNetworksChangedCallback();
@ -654,8 +653,8 @@ void AndroidNetworkMonitor::NotifyOfNetworkConnect(
const JavaRef<jobject>& j_network_info) {
NetworkInformation network_info =
GetNetworkInformationFromJava(env, j_network_info);
network_thread_->PostTask(ToQueuedTask(
safety_flag_, [this, network_info = std::move(network_info)] {
network_thread_->PostTask(
SafeTask(safety_flag_, [this, network_info = std::move(network_info)] {
OnNetworkConnected_n(network_info);
}));
}
@ -664,7 +663,7 @@ void AndroidNetworkMonitor::NotifyOfNetworkDisconnect(
JNIEnv* env,
const JavaRef<jobject>& j_caller,
jlong network_handle) {
network_thread_->PostTask(ToQueuedTask(safety_flag_, [this, network_handle] {
network_thread_->PostTask(SafeTask(safety_flag_, [this, network_handle] {
OnNetworkDisconnected_n(static_cast<NetworkHandle>(network_handle));
}));
}
@ -678,9 +677,9 @@ void AndroidNetworkMonitor::NotifyOfNetworkPreference(
rtc::NetworkPreference preference =
static_cast<rtc::NetworkPreference>(jpreference);
network_thread_->PostTask(ToQueuedTask(
safety_flag_,
[this, type, preference] { OnNetworkPreference_n(type, preference); }));
network_thread_->PostTask(SafeTask(safety_flag_, [this, type, preference] {
OnNetworkPreference_n(type, preference);
}));
}
} // namespace jni

View File

@ -12,7 +12,6 @@
#include <utility>
#include "api/task_queue/to_queued_task.h"
#include "common_video/h264/h264_common.h"
#include "modules/video_coding/include/video_codec_interface.h"
#include "modules/video_coding/include/video_error_codes.h"

View File

@ -11,8 +11,6 @@
#include "sdk/objc/native/src/objc_network_monitor.h"
#include "absl/strings/string_view.h"
#include "api/task_queue/to_queued_task.h"
#include <algorithm>
#include "rtc_base/logging.h"
@ -87,7 +85,7 @@ rtc::NetworkMonitorInterface::InterfaceInfo ObjCNetworkMonitor::GetInterfaceInfo
void ObjCNetworkMonitor::OnPathUpdate(
std::map<std::string, rtc::AdapterType, rtc::AbslStringViewCmp> adapter_type_by_name) {
RTC_DCHECK(network_monitor_ != nil);
thread_->PostTask(ToQueuedTask(safety_flag_, [this, adapter_type_by_name] {
thread_->PostTask(SafeTask(safety_flag_, [this, adapter_type_by_name] {
RTC_DCHECK_RUN_ON(thread_);
adapter_type_by_name_ = adapter_type_by_name;
InvokeNetworksChangedCallback();