blob: 2406bc0c78d34da8977f1cc41c194145fc99d9ca [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 += [
46 # This is the only Chromium target that can depend on this. The reason
47 # behind this is the fact that this is a 'testonly' target and as such
48 # it cannot be part of the WebRTC component.
49 "//third_party/blink/renderer/platform:blink_platform_unittests_sources",
50 ]
51
Mirko Bonadeic04792e2019-10-22 14:57:03 -070052 # Don't depend on WebRTC code outside of webrtc_overrides:webrtc_component
53 # because this will break the WebRTC component build in Chromium.
54 deps = [
55 "../../../webrtc_overrides:webrtc_component",
56 "../../test:test_support",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020057 ]
58 absl_deps = [
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020059 "//third_party/abseil-cpp/absl/cleanup",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070060 "//third_party/abseil-cpp/absl/strings",
61 ]
62 } else {
63 deps = [
Ali Tofigh4b681942022-08-23 12:57:16 +020064 ":default_task_queue_factory",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070065 ":task_queue",
Ali Tofigh4b681942022-08-23 12:57:16 +020066 "../../api:field_trials_view",
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020067 "../../api/units:time_delta",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070068 "../../rtc_base:refcount",
69 "../../rtc_base:rtc_event",
70 "../../rtc_base:timeutils",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070071 "../../test:test_support",
Mirko Bonadei2dcf3482020-06-05 14:30:41 +020072 ]
73 absl_deps = [
Danil Chapovalov8feb6fd2022-07-05 11:01:27 +020074 "//third_party/abseil-cpp/absl/cleanup",
Mirko Bonadeic04792e2019-10-22 14:57:03 -070075 "//third_party/abseil-cpp/absl/strings",
76 ]
77 }
Danil Chapovalov33b716f2019-01-22 18:15:37 +010078}
79
Mirko Bonadei86d053c2019-10-17 21:32:04 +020080rtc_library("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010081 visibility = [ "*" ]
Danil Chapovalov41300af2019-07-10 12:44:43 +020082 if (!is_ios && !is_android) {
83 poisonous = [ "default_task_queue" ]
84 }
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +010085 sources = [ "default_task_queue_factory.h" ]
Ali Tofigh4b681942022-08-23 12:57:16 +020086 deps = [
87 ":task_queue",
88 "../../api:field_trials_view",
89 "../../rtc_base/memory:always_valid_pointer",
90 ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010091
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000092 if (rtc_enable_libevent) {
Ali Tofigh4b681942022-08-23 12:57:16 +020093 if (is_android) {
94 sources +=
95 [ "default_task_queue_factory_stdlib_or_libevent_experiment.cc" ]
96 deps += [
97 "../../api/transport:field_trial_based_config",
98 "../../rtc_base:logging",
99 "../../rtc_base:rtc_task_queue_libevent",
100 "../../rtc_base:rtc_task_queue_stdlib",
101 ]
102 } else {
103 sources += [ "default_task_queue_factory_libevent.cc" ]
104 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
105 }
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000106 } else if (is_mac || is_ios) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100107 sources += [ "default_task_queue_factory_gcd.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000108 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
109 } else if (is_win && current_os != "winuwp") {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100110 sources += [ "default_task_queue_factory_win.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000111 deps += [ "../../rtc_base:rtc_task_queue_win" ]
112 } else {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100113 sources += [ "default_task_queue_factory_stdlib.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +0000114 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +0100115 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100116}
117
Artem Titovc374d112022-06-16 21:27:45 +0200118rtc_library("pending_task_safety_flag") {
Artem Titovef159282022-06-17 13:07:03 +0200119 visibility = [ "*" ]
Artem Titovc374d112022-06-16 21:27:45 +0200120 sources = [
121 "pending_task_safety_flag.cc",
122 "pending_task_safety_flag.h",
123 ]
124 deps = [
125 "../../api:refcountedbase",
126 "../../api:scoped_refptr",
127 "../../api:sequence_checker",
128 "../../rtc_base:checks",
129 "../../rtc_base/system:no_unique_address",
130 ]
Danil Chapovalova7e15a22022-07-05 16:03:03 +0200131 absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ]
Artem Titovc374d112022-06-16 21:27:45 +0200132}
133
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100134if (rtc_include_tests) {
Mirko Bonadei86d053c2019-10-17 21:32:04 +0200135 rtc_library("task_queue_default_factory_unittests") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100136 testonly = true
Mirko Bonadeiccbe95f2020-01-21 12:10:10 +0100137 sources = [ "default_task_queue_factory_unittest.cc" ]
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100138 deps = [
139 ":default_task_queue_factory",
140 ":task_queue_test",
141 "../../test:test_support",
142 ]
143 }
Artem Titovc374d112022-06-16 21:27:45 +0200144
Artem Titovc374d112022-06-16 21:27:45 +0200145 rtc_library("pending_task_safety_flag_unittests") {
146 testonly = true
147 sources = [ "pending_task_safety_flag_unittest.cc" ]
148 deps = [
149 ":pending_task_safety_flag",
Artem Titovc374d112022-06-16 21:27:45 +0200150 "../../rtc_base:logging",
151 "../../rtc_base:rtc_event",
152 "../../rtc_base:rtc_task_queue",
153 "../../rtc_base:task_queue_for_test",
154 "../../test:test_support",
155 ]
156 }
Danil Chapovalov2684ab32019-02-26 10:18:08 +0100157}