blob: f6bbbc3e70ae53f8c04deb4603ac382c5297b5ec [file] [log] [blame]
Danil Chapovalov959e9b62019-01-14 14:29:18 +01001# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
2#
3# Use of this source code is governed by a BSD-style license
4# that can be found in the LICENSE file in the root of the source
5# tree. An additional intellectual property rights grant can be found
6# in the file PATENTS. All contributing project authors may
7# be found in the AUTHORS file in the root of the source tree.
8
9import("../../webrtc.gni")
10
11rtc_source_set("task_queue") {
12 visibility = [ "*" ]
13 public = [
14 "queued_task.h",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010015 "task_queue_base.h",
16 "task_queue_factory.h",
17 ]
18 sources = [
19 "task_queue_base.cc",
20 ]
21
22 deps = [
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +010023 "../../rtc_base:checks",
Danil Chapovalov47cf5ea2019-02-19 20:20:16 +010024 "//third_party/abseil-cpp/absl/base:config",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010025 "//third_party/abseil-cpp/absl/base:core_headers",
26 "//third_party/abseil-cpp/absl/strings",
Danil Chapovalov959e9b62019-01-14 14:29:18 +010027 ]
28}
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010029
Danil Chapovalovd00405f2019-02-25 15:06:13 +010030# TODO(danilchap): Remove this empty target when downstream project stop depending on it.
31rtc_source_set("task_queue_factory") {
32 visibility = [ "*" ]
33}
34
Danil Chapovalov33b716f2019-01-22 18:15:37 +010035rtc_source_set("task_queue_test") {
36 visibility = [ "*" ]
37 testonly = true
38 sources = [
39 "task_queue_test.cc",
40 "task_queue_test.h",
41 ]
42 deps = [
43 ":task_queue",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010044 "../../rtc_base:rtc_event",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010045 "../../rtc_base:timeutils",
Danil Chapovalov3b548dd2019-03-01 14:58:44 +010046 "../../rtc_base/task_utils:to_queued_task",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010047 "../../test:test_support",
48 "//third_party/abseil-cpp/absl/memory",
49 "//third_party/abseil-cpp/absl/strings",
50 ]
51}
52
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010053rtc_source_set("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010054 visibility = [ "*" ]
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010055 sources = [
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010056 "default_task_queue_factory.h",
57 ]
58 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +010059 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010060 ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010061
62 # TODO(bugs.webrtc.org/10284): Include implementation unconditionally when
63 # global task queue factory is removed.
64 if (rtc_link_task_queue_impl) {
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000065 deps += [ ":default_task_queue_factory_impl" ]
66 }
67}
68
69# TODO(bugs.webrtc.org/10191): Merge back to default_task_queue_factory when
70# rtc_task_queue_impl build target is removed.
71rtc_source_set("default_task_queue_factory_impl") {
72 # Include the implementation when rtc_link_task_queue_impl is set to default
73 # value of true or when explicit dependency on "rtc_task_queue_impl" is added.
74 visibility = [
75 ":default_task_queue_factory",
76 "../../rtc_base:rtc_task_queue_impl",
77 ]
78 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +010079 ":task_queue",
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000080 ]
81 if (rtc_enable_libevent) {
82 sources = [
83 "default_task_queue_factory_libevent.cc",
84 ]
85 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
86 } else if (is_mac || is_ios) {
87 sources = [
88 "default_task_queue_factory_gcd.cc",
89 ]
90 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
91 } else if (is_win && current_os != "winuwp") {
92 sources = [
93 "default_task_queue_factory_win.cc",
94 ]
95 deps += [ "../../rtc_base:rtc_task_queue_win" ]
96 } else {
97 sources = [
98 "default_task_queue_factory_stdlib.cc",
99 ]
100 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +0100101 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100102}
103
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100104if (rtc_include_tests) {
105 rtc_source_set("task_queue_default_factory_unittests") {
106 testonly = true
107 sources = [
108 "default_task_queue_factory_unittest.cc",
109 ]
110 deps = [
111 ":default_task_queue_factory",
112 ":task_queue_test",
113 "../../test:test_support",
114 ]
115 }
116}
117
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +0100118# Linking with global_task_queue_factory adds link-time implementation of the
119# rtc::TaskQueue that allows run-time injection of the TaskQueue implementaion.
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100120rtc_source_set("global_task_queue_factory") {
Danil Chapovalov87ce8742019-02-01 19:40:11 +0100121 # TODO(bugs.webrtc.org/10284): Remove this target when task queue factory
122 # propagated to all components that create TaskQueues.
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100123 visibility = [ "*" ]
124 sources = [
125 "global_task_queue_factory.cc",
126 "global_task_queue_factory.h",
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +0100127
128 # TODO(bugs.webrtc.org/10191): Move task_queue.cc to private build
129 # "rtc_task_queue" when "rtc_task_queue_api", "rtc_task_queue",
130 # and "rtc_task_queue_impl" can be joined.
131 "task_queue.cc",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100132 ]
133 deps = [
134 ":default_task_queue_factory",
Danil Chapovalovd00405f2019-02-25 15:06:13 +0100135 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100136 "../../rtc_base:checks",
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +0100137 "../../rtc_base:rtc_task_queue_api",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100138 ]
139}