blob: 368b3b0ed7a605392a1fba21a6770cdc1c6fe016 [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
Mirko Bonadei86d053c2019-10-17 21:32:04 +020011rtc_library("task_queue") {
Danil Chapovalov959e9b62019-01-14 14:29:18 +010012 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 ]
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010018 sources = [ "task_queue_base.cc" ]
Danil Chapovalov348b08a2019-01-17 13:07:25 +010019
20 deps = [
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +010021 "../../rtc_base:checks",
Danil Chapovalov4423c362019-03-06 18:41:39 +010022 "../../rtc_base:macromagic",
Mirko Bonadeid4002a72019-11-12 20:11:48 +010023 "../../rtc_base/system:rtc_export",
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020024 "../units:time_delta",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020025 ]
26 absl_deps = [
Danil Chapovalov47cf5ea2019-02-19 20:20:16 +010027 "//third_party/abseil-cpp/absl/base:config",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010028 "//third_party/abseil-cpp/absl/base:core_headers",
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020029 "//third_party/abseil-cpp/absl/functional:any_invocable",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010030 "//third_party/abseil-cpp/absl/strings",
Danil Chapovalov959e9b62019-01-14 14:29:18 +010031 ]
32}
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010033
Mirko Bonadei86d053c2019-10-17 21:32:04 +020034rtc_library("task_queue_test") {
Danil Chapovalov33b716f2019-01-22 18:15:37 +010035 visibility = [ "*" ]
36 testonly = true
37 sources = [
38 "task_queue_test.cc",
39 "task_queue_test.h",
40 ]
Mirko Bonadeic04792e2019-10-22 14:57:03 -070041
42 check_includes = false # no-presubmit-check TODO(bugs.webrtc.org/9419)
43 if (build_with_chromium) {
Mirko Bonadei92dd35d2019-11-15 16:08:41 +010044 visibility = []
45 visibility = webrtc_default_visibility
46 visibility += [
47 # This is the only Chromium target that can depend on this. The reason
48 # behind this is the fact that this is a 'testonly' target and as such
49 # it cannot be part of the WebRTC component.
50 "//third_party/blink/renderer/platform:blink_platform_unittests_sources",
51 ]
52
Mirko Bonadeic04792e2019-10-22 14:57:03 -070053 # Don't depend on WebRTC code outside of webrtc_overrides:webrtc_component
54 # because this will break the WebRTC component build in Chromium.
55 deps = [
56 "../../../webrtc_overrides:webrtc_component",
57 "../../test:test_support",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020058 ]
59 absl_deps = [
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020060 "//third_party/abseil-cpp/absl/cleanup",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070061 "//third_party/abseil-cpp/absl/strings",
62 ]
63 } else {
64 deps = [
65 ":task_queue",
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020066 "../../api/units:time_delta",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070067 "../../rtc_base:refcount",
68 "../../rtc_base:rtc_event",
69 "../../rtc_base:timeutils",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070070 "../../test:test_support",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020071 ]
72 absl_deps = [
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020073 "//third_party/abseil-cpp/absl/cleanup",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070074 "//third_party/abseil-cpp/absl/strings",
75 ]
76 }
Danil Chapovalov33b716f2019-01-22 18:15:37 +010077}
78
Mirko Bonadei86d053c2019-10-17 21:32:04 +020079rtc_library("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010080 visibility = [ "*" ]
Danil Chapovalov41300af2019-07-10 12:44:43 +020081 if (!is_ios && !is_android) {
82 poisonous = [ "default_task_queue" ]
83 }
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010084 sources = [ "default_task_queue_factory.h" ]
85 deps = [ ":task_queue" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010086
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000087 if (rtc_enable_libevent) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010088 sources += [ "default_task_queue_factory_libevent.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000089 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
90 } else if (is_mac || is_ios) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010091 sources += [ "default_task_queue_factory_gcd.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000092 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
93 } else if (is_win && current_os != "winuwp") {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010094 sources += [ "default_task_queue_factory_win.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000095 deps += [ "../../rtc_base:rtc_task_queue_win" ]
96 } else {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010097 sources += [ "default_task_queue_factory_stdlib.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000098 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010099 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100100}
101
Artem Titovc374d112022-06-16 21:27:45 +0200102rtc_source_set("to_queued_task") {
103 visibility = [ "*" ]
104 sources = [ "to_queued_task.h" ]
105 deps = [
106 ":task_queue",
107 "../../api/task_queue:pending_task_safety_flag",
108 ]
109}
110
111rtc_library("pending_task_safety_flag") {
Artem Titovef159282022-06-17 13:07:03 +0200112 visibility = [ "*" ]
Artem Titovc374d112022-06-16 21:27:45 +0200113 sources = [
114 "pending_task_safety_flag.cc",
115 "pending_task_safety_flag.h",
116 ]
117 deps = [
118 "../../api:refcountedbase",
119 "../../api:scoped_refptr",
120 "../../api:sequence_checker",
121 "../../rtc_base:checks",
122 "../../rtc_base/system:no_unique_address",
123 ]
124}
125
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100126if (rtc_include_tests) {
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200127 rtc_library("task_queue_default_factory_unittests") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100128 testonly = true
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100129 sources = [ "default_task_queue_factory_unittest.cc" ]
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100130 deps = [
131 ":default_task_queue_factory",
132 ":task_queue_test",
133 "../../test:test_support",
134 ]
135 }
Artem Titovc374d112022-06-16 21:27:45 +0200136
137 rtc_library("to_queued_task_unittests") {
138 testonly = true
139 sources = [ "to_queued_task_unittest.cc" ]
140 deps = [
141 ":to_queued_task",
142 "../../api/task_queue",
143 "../../test:test_support",
144 ]
145 absl_deps = [ "//third_party/abseil-cpp/absl/memory" ]
146 }
147
148 rtc_library("pending_task_safety_flag_unittests") {
149 testonly = true
150 sources = [ "pending_task_safety_flag_unittest.cc" ]
151 deps = [
152 ":pending_task_safety_flag",
153 ":to_queued_task",
154 "../../rtc_base:logging",
155 "../../rtc_base:rtc_event",
156 "../../rtc_base:rtc_task_queue",
157 "../../rtc_base:task_queue_for_test",
158 "../../test:test_support",
159 ]
160 }
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100161}