From 07a4f2b267b1ea02472892c6f3ffb3f2bf9847a2 Mon Sep 17 00:00:00 2001 From: Danil Chapovalov Date: Tue, 5 Mar 2019 19:58:28 +0100 Subject: [PATCH] Merge rtc_task_queue(_api|_impl)? build targets into one Ignore rtc_link_task_queue_impl flag, instead use build_with_chromium for custom chromium implementation injection This changes TaskQueue implementation used in webrtc fuzzers in chromium: from own webrtc implementation to chromium's. Bug: webrtc:10191 Change-Id: I63be28b680ae8ea8ee1dbf0c699263c392ce29d3 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/125196 Commit-Queue: Danil Chapovalov Reviewed-by: Karl Wiberg Reviewed-by: Mirko Bonadei Cr-Commit-Position: refs/heads/master@{#26977} --- api/task_queue/BUILD.gn | 51 +++++--------------- rtc_base/BUILD.gn | 55 +++++++--------------- {api/task_queue => rtc_base}/task_queue.cc | 0 rtc_base/task_utils/BUILD.gn | 2 +- sdk/android/BUILD.gn | 4 +- test/fuzzers/BUILD.gn | 4 -- test/scenario/network/BUILD.gn | 2 +- video/BUILD.gn | 2 +- 8 files changed, 32 insertions(+), 88 deletions(-) rename {api/task_queue => rtc_base}/task_queue.cc (100%) diff --git a/api/task_queue/BUILD.gn b/api/task_queue/BUILD.gn index f6bbbc3e70..c0648b77ea 100644 --- a/api/task_queue/BUILD.gn +++ b/api/task_queue/BUILD.gn @@ -59,44 +59,17 @@ rtc_source_set("default_task_queue_factory") { ":task_queue", ] - # TODO(bugs.webrtc.org/10284): Include implementation unconditionally when - # global task queue factory is removed. - if (rtc_link_task_queue_impl) { - deps += [ ":default_task_queue_factory_impl" ] - } -} - -# TODO(bugs.webrtc.org/10191): Merge back to default_task_queue_factory when -# rtc_task_queue_impl build target is removed. -rtc_source_set("default_task_queue_factory_impl") { - # Include the implementation when rtc_link_task_queue_impl is set to default - # value of true or when explicit dependency on "rtc_task_queue_impl" is added. - visibility = [ - ":default_task_queue_factory", - "../../rtc_base:rtc_task_queue_impl", - ] - deps = [ - ":task_queue", - ] if (rtc_enable_libevent) { - sources = [ - "default_task_queue_factory_libevent.cc", - ] + sources += [ "default_task_queue_factory_libevent.cc" ] deps += [ "../../rtc_base:rtc_task_queue_libevent" ] } else if (is_mac || is_ios) { - sources = [ - "default_task_queue_factory_gcd.cc", - ] + sources += [ "default_task_queue_factory_gcd.cc" ] deps += [ "../../rtc_base:rtc_task_queue_gcd" ] } else if (is_win && current_os != "winuwp") { - sources = [ - "default_task_queue_factory_win.cc", - ] + sources += [ "default_task_queue_factory_win.cc" ] deps += [ "../../rtc_base:rtc_task_queue_win" ] } else { - sources = [ - "default_task_queue_factory_stdlib.cc", - ] + sources += [ "default_task_queue_factory_stdlib.cc" ] deps += [ "../../rtc_base:rtc_task_queue_stdlib" ] } } @@ -115,8 +88,6 @@ if (rtc_include_tests) { } } -# Linking with global_task_queue_factory adds link-time implementation of the -# rtc::TaskQueue that allows run-time injection of the TaskQueue implementaion. rtc_source_set("global_task_queue_factory") { # TODO(bugs.webrtc.org/10284): Remove this target when task queue factory # propagated to all components that create TaskQueues. @@ -124,16 +95,16 @@ rtc_source_set("global_task_queue_factory") { sources = [ "global_task_queue_factory.cc", "global_task_queue_factory.h", - - # TODO(bugs.webrtc.org/10191): Move task_queue.cc to private build - # "rtc_task_queue" when "rtc_task_queue_api", "rtc_task_queue", - # and "rtc_task_queue_impl" can be joined. - "task_queue.cc", ] deps = [ - ":default_task_queue_factory", ":task_queue", "../../rtc_base:checks", - "../../rtc_base:rtc_task_queue_api", ] + + if (build_with_chromium) { + # Chromium uses link-time injection of the CreateDefaultTaskQueueFactory + sources += [ "default_task_queue_factory.h" ] + } else { + deps += [ ":default_task_queue_factory" ] + } } diff --git a/rtc_base/BUILD.gn b/rtc_base/BUILD.gn index bb4a256211..84d558c9a6 100644 --- a/rtc_base/BUILD.gn +++ b/rtc_base/BUILD.gn @@ -468,46 +468,33 @@ if (is_mac && !build_with_chromium) { rtc_source_set("rtc_task_queue") { visibility = [ "*" ] - deps = [] - public_deps = [ - ":rtc_task_queue_api", - ] - - if (rtc_link_task_queue_impl) { - deps += [ ":rtc_task_queue_impl" ] - } -} - -# WebRTC targets must not directly depend on rtc_task_queue_api or -# rtc_task_queue_impl. Instead, depend on rtc_task_queue. -# The build flag |rtc_link_task_queue_impl| decides if WebRTC targets will link -# to the default implemenation in rtc_task_queue_impl or if an externally -# provided implementation should be used. An external implementation should -# depend on rtc_task_queue_api. -rtc_source_set("rtc_task_queue_api") { - # The visibility list is commented out so that we won't break external - # implementations, but left here to manually test as well as for sake of what - # targets we expect to depend on rtc_task_queue_api. - # visibility = [ - # ":rtc_task_queue", - # ":rtc_task_queue_impl", - # ":sequenced_task_checker", - # ] sources = [ + "task_queue.cc", "task_queue.h", ] deps = [ ":macromagic", "../api/task_queue", + "../api/task_queue:global_task_queue_factory", "system:rtc_export", "task_utils:to_queued_task", "//third_party/abseil-cpp/absl/memory", ] + + # TODO(danilchap): Move this conditional dependency to global_task_queue_factory + # after removing task_queue_impl -> global_task_queue_factory dependency in chromium. + if (build_with_chromium) { + deps += [ "../../webrtc_overrides:task_queue_impl" ] + } +} + +rtc_source_set("rtc_task_queue_api") { + visibility = [ "*" ] } if (rtc_enable_libevent) { rtc_source_set("rtc_task_queue_libevent") { - visibility = [ "../api/task_queue:default_task_queue_factory_impl" ] + visibility = [ "../api/task_queue:default_task_queue_factory" ] sources = [ "task_queue_libevent.cc", "task_queue_libevent.h", @@ -533,7 +520,7 @@ if (rtc_enable_libevent) { if (is_mac || is_ios) { rtc_source_set("rtc_task_queue_gcd") { - visibility = [ "../api/task_queue:default_task_queue_factory_impl" ] + visibility = [ "../api/task_queue:default_task_queue_factory" ] sources = [ "task_queue_gcd.cc", "task_queue_gcd.h", @@ -550,7 +537,7 @@ if (is_mac || is_ios) { if (is_win) { rtc_source_set("rtc_task_queue_win") { - visibility = [ "../api/task_queue:default_task_queue_factory_impl" ] + visibility = [ "../api/task_queue:default_task_queue_factory" ] sources = [ "task_queue_win.cc", "task_queue_win.h", @@ -562,7 +549,6 @@ if (is_win) { ":macromagic", ":platform_thread", ":rtc_event", - ":rtc_task_queue_api", ":safe_conversions", ":timeutils", "../api/task_queue", @@ -573,7 +559,7 @@ if (is_win) { } rtc_source_set("rtc_task_queue_stdlib") { - visibility = [ "../api/task_queue:default_task_queue_factory_impl" ] + visibility = [ "../api/task_queue:default_task_queue_factory" ] sources = [ "task_queue_stdlib.cc", "task_queue_stdlib.h", @@ -585,7 +571,6 @@ rtc_source_set("rtc_task_queue_stdlib") { ":macromagic", ":platform_thread", ":rtc_event", - ":rtc_task_queue_api", ":safe_conversions", ":timeutils", "../api/task_queue", @@ -594,14 +579,6 @@ rtc_source_set("rtc_task_queue_stdlib") { ] } -rtc_source_set("rtc_task_queue_impl") { - visibility = [ "*" ] - deps = [ - "../api/task_queue:default_task_queue_factory_impl", - "../api/task_queue:global_task_queue_factory", - ] -} - rtc_source_set("sequenced_task_checker") { sources = [ "sequenced_task_checker.h", diff --git a/api/task_queue/task_queue.cc b/rtc_base/task_queue.cc similarity index 100% rename from api/task_queue/task_queue.cc rename to rtc_base/task_queue.cc diff --git a/rtc_base/task_utils/BUILD.gn b/rtc_base/task_utils/BUILD.gn index 126bff8b65..0ec6739d8c 100644 --- a/rtc_base/task_utils/BUILD.gn +++ b/rtc_base/task_utils/BUILD.gn @@ -15,7 +15,7 @@ rtc_source_set("repeating_task") { ] deps = [ "..:logging", - "..:rtc_task_queue_api", + "..:rtc_task_queue", "..:sequenced_task_checker", "..:thread_checker", "..:timeutils", diff --git a/sdk/android/BUILD.gn b/sdk/android/BUILD.gn index fcae6b2480..fe1f19e7c0 100644 --- a/sdk/android/BUILD.gn +++ b/sdk/android/BUILD.gn @@ -629,7 +629,7 @@ if (is_android) { "../../modules/video_coding:video_coding_utility", "../../rtc_base:checks", "../../rtc_base:rtc_base", - "../../rtc_base:rtc_task_queue_api", + "../../rtc_base:rtc_task_queue", "../../rtc_base:sequenced_task_checker", "../../rtc_base:weak_ptr", "../../system_wrappers:field_trial", @@ -690,7 +690,7 @@ if (is_android) { "../../modules/video_coding:video_coding_utility", "../../rtc_base:checks", "../../rtc_base:rtc_base", - "../../rtc_base:rtc_task_queue_api", + "../../rtc_base:rtc_task_queue", "//third_party/libyuv", ] } diff --git a/test/fuzzers/BUILD.gn b/test/fuzzers/BUILD.gn index a7f2b68a6e..6eee940d4d 100644 --- a/test/fuzzers/BUILD.gn +++ b/test/fuzzers/BUILD.gn @@ -47,10 +47,6 @@ template("webrtc_fuzzer_test") { deps += [ ":fuzz_data_helper", ":webrtc_fuzzer_main", - - # Link unconditionally with webrtc's TaskQueue, regardless of - # rtc_link_task_queue_impl flag. - "../../rtc_base:rtc_task_queue_impl", ] if (!build_with_chromium && is_clang) { suppressed_configs = [ "//build/config/clang:find_bad_constructs" ] diff --git a/test/scenario/network/BUILD.gn b/test/scenario/network/BUILD.gn index 3a00d06f9e..3a2270f852 100644 --- a/test/scenario/network/BUILD.gn +++ b/test/scenario/network/BUILD.gn @@ -32,7 +32,7 @@ rtc_source_set("emulated_network") { "../../../api/units:time_delta", "../../../api/units:timestamp", "../../../rtc_base:rtc_base", - "../../../rtc_base:rtc_task_queue_api", + "../../../rtc_base:rtc_task_queue", "../../../rtc_base:safe_minmax", "../../../rtc_base/task_utils:repeating_task", "../../../rtc_base/third_party/sigslot:sigslot", diff --git a/video/BUILD.gn b/video/BUILD.gn index de139918a4..17b05de4c2 100644 --- a/video/BUILD.gn +++ b/video/BUILD.gn @@ -132,7 +132,7 @@ rtc_source_set("video_stream_decoder_impl") { "../api/video_codecs:video_codecs_api", "../modules/video_coding:video_coding", "../rtc_base:rtc_base_approved", - "../rtc_base:rtc_task_queue_api", + "../rtc_base:rtc_task_queue", "../system_wrappers:system_wrappers", "//third_party/abseil-cpp/absl/memory", "//third_party/abseil-cpp/absl/types:optional",