blob: e7e3aec32f485a6206fd39d28a6d2532c51ae6cb [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_priority.h",
16 ]
17}
18
19# TODO(bugs.webrtc.org/10191): Merge the target into task_queue target above
20# when support for link-time injection is dropped.
21rtc_source_set("task_queue_factory") {
22 visibility = [ "*" ]
23 public = [
24 "task_queue_base.h",
25 "task_queue_factory.h",
26 ]
27 sources = [
28 "task_queue_base.cc",
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +010029 "task_queue_impl.cc",
30 "task_queue_impl.h",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010031 ]
32
33 deps = [
34 ":task_queue",
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +010035 "../../rtc_base:checks",
36 "../../rtc_base:rtc_task_queue_api",
Danil Chapovalov47cf5ea2019-02-19 20:20:16 +010037 "//third_party/abseil-cpp/absl/base:config",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010038 "//third_party/abseil-cpp/absl/base:core_headers",
39 "//third_party/abseil-cpp/absl/strings",
Danil Chapovalov959e9b62019-01-14 14:29:18 +010040 ]
41}
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010042
Danil Chapovalov33b716f2019-01-22 18:15:37 +010043rtc_source_set("task_queue_test") {
44 visibility = [ "*" ]
45 testonly = true
46 sources = [
47 "task_queue_test.cc",
48 "task_queue_test.h",
49 ]
50 deps = [
51 ":task_queue",
52 ":task_queue_factory",
53 "../../rtc_base:rtc_event",
54 "../../rtc_base:rtc_task_queue_api",
55 "../../rtc_base:timeutils",
56 "../../test:test_support",
57 "//third_party/abseil-cpp/absl/memory",
58 "//third_party/abseil-cpp/absl/strings",
59 ]
60}
61
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010062rtc_source_set("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010063 visibility = [ "*" ]
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010064 sources = [
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010065 "default_task_queue_factory.h",
66 ]
67 deps = [
68 ":task_queue_factory",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010069 ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010070
71 # TODO(bugs.webrtc.org/10284): Include implementation unconditionally when
72 # global task queue factory is removed.
73 if (rtc_link_task_queue_impl) {
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000074 deps += [ ":default_task_queue_factory_impl" ]
75 }
76}
77
78# TODO(bugs.webrtc.org/10191): Merge back to default_task_queue_factory when
79# rtc_task_queue_impl build target is removed.
80rtc_source_set("default_task_queue_factory_impl") {
81 # Include the implementation when rtc_link_task_queue_impl is set to default
82 # value of true or when explicit dependency on "rtc_task_queue_impl" is added.
83 visibility = [
84 ":default_task_queue_factory",
85 "../../rtc_base:rtc_task_queue_impl",
86 ]
87 deps = [
88 ":task_queue_factory",
89 ]
90 if (rtc_enable_libevent) {
91 sources = [
92 "default_task_queue_factory_libevent.cc",
93 ]
94 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
95 } else if (is_mac || is_ios) {
96 sources = [
97 "default_task_queue_factory_gcd.cc",
98 ]
99 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
100 } else if (is_win && current_os != "winuwp") {
101 sources = [
102 "default_task_queue_factory_win.cc",
103 ]
104 deps += [ "../../rtc_base:rtc_task_queue_win" ]
105 } else {
106 sources = [
107 "default_task_queue_factory_stdlib.cc",
108 ]
109 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +0100110 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100111}
112
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100113if (rtc_include_tests) {
114 rtc_source_set("task_queue_default_factory_unittests") {
115 testonly = true
116 sources = [
117 "default_task_queue_factory_unittest.cc",
118 ]
119 deps = [
120 ":default_task_queue_factory",
121 ":task_queue_test",
122 "../../test:test_support",
123 ]
124 }
125}
126
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +0100127# Linking with global_task_queue_factory adds link-time implementation of the
128# rtc::TaskQueue that allows run-time injection of the TaskQueue implementaion.
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100129rtc_source_set("global_task_queue_factory") {
Danil Chapovalov87ce8742019-02-01 19:40:11 +0100130 # TODO(bugs.webrtc.org/10284): Remove this target when task queue factory
131 # propagated to all components that create TaskQueues.
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100132 visibility = [ "*" ]
133 sources = [
134 "global_task_queue_factory.cc",
135 "global_task_queue_factory.h",
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +0100136
137 # TODO(bugs.webrtc.org/10191): Move task_queue.cc to private build
138 # "rtc_task_queue" when "rtc_task_queue_api", "rtc_task_queue",
139 # and "rtc_task_queue_impl" can be joined.
140 "task_queue.cc",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100141 ]
142 deps = [
143 ":default_task_queue_factory",
144 ":task_queue_factory",
145 "../../rtc_base:checks",
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +0100146 "../../rtc_base:rtc_task_queue_api",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100147 ]
148}