Poison default task queue factory
Users of webrtc generally should be able to choose own task queue implementation.
Poison avoids accidental dependency of a low level component on the default implementation
Android and ios apis are still de-facto forced to use the default implementation.
Bug: webrtc:10284
Change-Id: I67ecf2317f43ee32b0c9e8a6e69f1e0987cf1914
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/144786
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28524}
diff --git a/BUILD.gn b/BUILD.gn
index 8334573..af0de9f 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -675,3 +675,6 @@
group("poison_software_video_codecs") {
}
+
+group("poison_default_task_queue") {
+}
diff --git a/api/BUILD.gn b/api/BUILD.gn
index 01d79ea..645daee 100644
--- a/api/BUILD.gn
+++ b/api/BUILD.gn
@@ -38,6 +38,7 @@
if (!build_with_chromium) {
rtc_static_library("create_peerconnection_factory") {
visibility = [ "*" ]
+ allow_poison = [ "default_task_queue" ]
sources = [
"create_peerconnection_factory.cc",
"create_peerconnection_factory.h",
diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn
index 19b9e0e..4b84607 100644
--- a/api/task_queue/BUILD.gn
+++ b/api/task_queue/BUILD.gn
@@ -49,6 +49,9 @@
rtc_source_set("default_task_queue_factory") {
visibility = [ "*" ]
+ if (!is_ios && !is_android) {
+ poisonous = [ "default_task_queue" ]
+ }
sources = [
"default_task_queue_factory.h",
]
diff --git a/media/BUILD.gn b/media/BUILD.gn
index 6361fb8..bf585ac 100644
--- a/media/BUILD.gn
+++ b/media/BUILD.gn
@@ -343,6 +343,7 @@
visibility = [ "*" ]
allow_poison = [
"audio_codecs",
+ "default_task_queue",
"software_video_codecs",
]
sources = [
diff --git a/sdk/BUILD.gn b/sdk/BUILD.gn
index 2eab502..8303d8a 100644
--- a/sdk/BUILD.gn
+++ b/sdk/BUILD.gn
@@ -459,7 +459,10 @@
if (rtc_use_metal_rendering) {
rtc_static_library("metal_objc") {
visibility = [ "*" ]
- allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
+ allow_poison = [
+ "audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
+ "default_task_queue",
+ ]
sources = [
"objc/components/renderer/metal/RTCMTLI420Renderer.h",
"objc/components/renderer/metal/RTCMTLI420Renderer.mm",
@@ -658,7 +661,10 @@
# The applications which only use WebRTC DataChannel can depend on this.
rtc_static_library("peerconnectionfactory_no_media_objc") {
visibility = [ "*" ]
- allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
+ allow_poison = [
+ "audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
+ "default_task_queue",
+ ]
defines = [ "HAVE_NO_MEDIA" ]
sources = [
@@ -776,7 +782,10 @@
rtc_static_library("peerconnectionfactory_base_objc") {
visibility = [ "*" ]
- allow_poison = [ "audio_codecs" ] # TODO(bugs.webrtc.org/8396): Remove.
+ allow_poison = [
+ "audio_codecs", # TODO(bugs.webrtc.org/8396): Remove.
+ "default_task_queue",
+ ]
configs += [
"..:no_exit_time_destructors",
"..:no_global_constructors",
@@ -908,7 +917,6 @@
":videorendereradapter_objc",
":videosource_objc",
":videotoolbox_objc",
- "../api:create_peerconnection_factory",
"../api:libjingle_peerconnection_api",
"../api:rtc_event_log_output_file",
"../api:rtc_stats_api",
diff --git a/webrtc.gni b/webrtc.gni
index 9e13283..e27a84a 100644
--- a/webrtc.gni
+++ b/webrtc.gni
@@ -368,6 +368,9 @@
# Software video codecs (VP8 and VP9 through libvpx).
"software_video_codecs",
+
+ # Default task queue implementation.
+ "default_task_queue",
]
absl_include_config = "//third_party/abseil-cpp:absl_include_config"