blob: 69393b80ff5f4907a7867ff61e5ed2ab8468b7d5 [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 = [
Danil Chapovalov348b08a2019-01-17 13:07:25 +010014 "task_queue_base.h",
15 "task_queue_factory.h",
16 ]
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010017 sources = [ "task_queue_base.cc" ]
Danil Chapovalov348b08a2019-01-17 13:07:25 +010018
19 deps = [
Danil Chapovalovb4c6d1e2019-01-21 13:52:59 +010020 "../../rtc_base:checks",
Danil Chapovalov4423c362019-03-06 18:41:39 +010021 "../../rtc_base:macromagic",
Mirko Bonadeid4002a72019-11-12 20:11:48 +010022 "../../rtc_base/system:rtc_export",
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020023 "../units:time_delta",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020024 ]
25 absl_deps = [
Danil Chapovalov47cf5ea2019-02-19 20:20:16 +010026 "//third_party/abseil-cpp/absl/base:config",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010027 "//third_party/abseil-cpp/absl/base:core_headers",
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020028 "//third_party/abseil-cpp/absl/functional:any_invocable",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010029 "//third_party/abseil-cpp/absl/strings",
Danil Chapovalov959e9b62019-01-14 14:29:18 +010030 ]
31}
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010032
Mirko Bonadei86d053c2019-10-17 21:32:04 +020033rtc_library("task_queue_test") {
Danil Chapovalov33b716f2019-01-22 18:15:37 +010034 visibility = [ "*" ]
35 testonly = true
36 sources = [
37 "task_queue_test.cc",
38 "task_queue_test.h",
39 ]
Mirko Bonadeic04792e2019-10-22 14:57:03 -070040
41 check_includes = false # no-presubmit-check TODO(bugs.webrtc.org/9419)
42 if (build_with_chromium) {
Mirko Bonadei92dd35d2019-11-15 16:08:41 +010043 visibility = []
44 visibility = webrtc_default_visibility
45 visibility += [
Markus Handellf76a8232022-09-19 14:47:48 +000046 # This is the only Chromium targets that can depend on this. The reason
47 # behind this is the fact that these are 'testonly' targets and as such
Mirko Bonadei92dd35d2019-11-15 16:08:41 +010048 # it cannot be part of the WebRTC component.
Markus Handellf76a8232022-09-19 14:47:48 +000049 "//components/webrtc:unit_tests",
Mirko Bonadei92dd35d2019-11-15 16:08:41 +010050 "//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 = [
Ali Tofigh4b681942022-08-23 12:57:16 +020065 ":default_task_queue_factory",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070066 ":task_queue",
Ali Tofigh4b681942022-08-23 12:57:16 +020067 "../../api:field_trials_view",
Markus Handell82da9322022-12-16 15:50:24 +010068 "../../api:make_ref_counted",
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020069 "../../api/units:time_delta",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070070 "../../rtc_base:refcount",
71 "../../rtc_base:rtc_event",
72 "../../rtc_base:timeutils",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070073 "../../test:test_support",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020074 ]
75 absl_deps = [
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020076 "//third_party/abseil-cpp/absl/cleanup",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070077 "//third_party/abseil-cpp/absl/strings",
78 ]
79 }
Danil Chapovalov33b716f2019-01-22 18:15:37 +010080}
81
Mirko Bonadei86d053c2019-10-17 21:32:04 +020082rtc_library("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010083 visibility = [ "*" ]
Danil Chapovalov41300af2019-07-10 12:44:43 +020084 if (!is_ios && !is_android) {
85 poisonous = [ "default_task_queue" ]
86 }
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010087 sources = [ "default_task_queue_factory.h" ]
Ali Tofigh4b681942022-08-23 12:57:16 +020088 deps = [
89 ":task_queue",
90 "../../api:field_trials_view",
91 "../../rtc_base/memory:always_valid_pointer",
92 ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010093
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000094 if (rtc_enable_libevent) {
Ali Tofigh4b681942022-08-23 12:57:16 +020095 if (is_android) {
96 sources +=
97 [ "default_task_queue_factory_stdlib_or_libevent_experiment.cc" ]
98 deps += [
99 "../../api/transport:field_trial_based_config",
100 "../../rtc_base:logging",
101 "../../rtc_base:rtc_task_queue_libevent",
102 "../../rtc_base:rtc_task_queue_stdlib",
103 ]
104 } else {
105 sources += [ "default_task_queue_factory_libevent.cc" ]
106 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
107 }
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000108 } else if (is_mac || is_ios) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100109 sources += [ "default_task_queue_factory_gcd.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000110 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
111 } else if (is_win && current_os != "winuwp") {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100112 sources += [ "default_task_queue_factory_win.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000113 deps += [ "../../rtc_base:rtc_task_queue_win" ]
114 } else {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100115 sources += [ "default_task_queue_factory_stdlib.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000116 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +0100117 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100118}
119
Artem Titovc374d112022-06-16 21:27:45 +0200120rtc_library("pending_task_safety_flag") {
Artem Titovef159282022-06-17 13:07:03 +0200121 visibility = [ "*" ]
Artem Titovc374d112022-06-16 21:27:45 +0200122 sources = [
123 "pending_task_safety_flag.cc",
124 "pending_task_safety_flag.h",
125 ]
126 deps = [
127 "../../api:refcountedbase",
128 "../../api:scoped_refptr",
129 "../../api:sequence_checker",
130 "../../rtc_base:checks",
131 "../../rtc_base/system:no_unique_address",
132 ]
Danil Chapovalova7e15a22022-07-05 16:03:03 +0200133 absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
Artem Titovc374d112022-06-16 21:27:45 +0200134}
135
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100136if (rtc_include_tests) {
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200137 rtc_library("task_queue_default_factory_unittests") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100138 testonly = true
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100139 sources = [ "default_task_queue_factory_unittest.cc" ]
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100140 deps = [
141 ":default_task_queue_factory",
142 ":task_queue_test",
143 "../../test:test_support",
144 ]
145 }
Artem Titovc374d112022-06-16 21:27:45 +0200146
Artem Titovc374d112022-06-16 21:27:45 +0200147 rtc_library("pending_task_safety_flag_unittests") {
148 testonly = true
149 sources = [ "pending_task_safety_flag_unittest.cc" ]
150 deps = [
151 ":pending_task_safety_flag",
Artem Titovc374d112022-06-16 21:27:45 +0200152 "../../rtc_base:logging",
153 "../../rtc_base:rtc_event",
154 "../../rtc_base:rtc_task_queue",
155 "../../rtc_base:task_queue_for_test",
156 "../../test:test_support",
157 ]
158 }
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100159}