This cl refactor TaskQueues to use a PIMPL implementation on linux/Android.
In later steps the Win/Mac implementation will also be refactored.
The rtc_task_queue target is split up in three separate targets:
rtc_task_queue_api:
Contains the header file task_queue.h but no implementation.
Only external TaskQueue implementations should directly depend on this target.
rtc_task_queue_impl:
Contains the default implementation of task_queue.h.
Only external application targets should directly depend on this target.
rtc_task_queue:
WebRTC targets should depend on this target. It unconditionally depend on rtc_task_queue_api and depending on the new build flag,|rtc_link_task_queue_impl|, depend on rtc_task_queue_impl.
BUG=webrtc:8160
Review-Url: https://codereview.webrtc.org/3003643002
Cr-Commit-Position: refs/heads/master@{#19516}
diff --git a/webrtc/rtc_base/BUILD.gn b/webrtc/rtc_base/BUILD.gn
index a9e82e5..d26d5e7 100644
--- a/webrtc/rtc_base/BUILD.gn
+++ b/webrtc/rtc_base/BUILD.gn
@@ -295,42 +295,71 @@
defines = [ "WEBRTC_BUILD_LIBEVENT" ]
}
-rtc_static_library("rtc_task_queue") {
+rtc_source_set("rtc_task_queue") {
public_deps = [
":rtc_base_approved",
+ ":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") {
if (build_with_chromium) {
sources = [
- "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
"../../webrtc_overrides/webrtc/rtc_base/task_queue.h",
]
} else {
sources = [
"task_queue.h",
- "task_queue_posix.h",
]
- if (rtc_build_libevent) {
- deps = [
- "//base/third_party/libevent",
- ]
- }
+ }
+ deps = [
+ ":rtc_base_approved",
+ ]
+}
+rtc_source_set("rtc_task_queue_impl") {
+ deps = [
+ ":rtc_base_approved",
+ ":rtc_task_queue_api",
+ ]
+ if (build_with_chromium) {
+ sources = [
+ "../../webrtc_overrides/webrtc/rtc_base/task_queue.cc",
+ ]
+ } else {
+ if (rtc_build_libevent) {
+ deps += [ "//base/third_party/libevent" ]
+ }
if (rtc_enable_libevent) {
- sources += [
+ sources = [
"task_queue_libevent.cc",
"task_queue_posix.cc",
+ "task_queue_posix.h",
]
all_dependent_configs = [ ":enable_libevent_config" ]
} else {
if (is_mac || is_ios) {
- sources += [
+ sources = [
"task_queue_gcd.cc",
"task_queue_posix.cc",
]
}
if (is_win) {
- sources += [ "task_queue_win.cc" ]
+ sources = [
+ "task_queue_win.cc",
+ ]
}
}
}