blob: 1394648e5f991d867a9d9d6e5021b4e24b48dbb7 [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 Chapovalov4423c362019-03-06 18:41:39 +010024 "../../rtc_base:macromagic",
Danil Chapovalov47cf5ea2019-02-19 20:20:16 +010025 "//third_party/abseil-cpp/absl/base:config",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010026 "//third_party/abseil-cpp/absl/base:core_headers",
27 "//third_party/abseil-cpp/absl/strings",
Danil Chapovalov959e9b62019-01-14 14:29:18 +010028 ]
29}
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010030
Danil Chapovalov33b716f2019-01-22 18:15:37 +010031rtc_source_set("task_queue_test") {
32 visibility = [ "*" ]
33 testonly = true
34 sources = [
35 "task_queue_test.cc",
36 "task_queue_test.h",
37 ]
38 deps = [
39 ":task_queue",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010040 "../../rtc_base:rtc_event",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010041 "../../rtc_base:timeutils",
Danil Chapovalov3b548dd2019-03-01 14:58:44 +010042 "../../rtc_base/task_utils:to_queued_task",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010043 "../../test:test_support",
44 "//third_party/abseil-cpp/absl/memory",
45 "//third_party/abseil-cpp/absl/strings",
46 ]
47}
48
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010049rtc_source_set("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010050 visibility = [ "*" ]
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010051 sources = [
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010052 "default_task_queue_factory.h",
53 ]
54 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +010055 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010056 ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010057
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000058 if (rtc_enable_libevent) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010059 sources += [ "default_task_queue_factory_libevent.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000060 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
61 } else if (is_mac || is_ios) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010062 sources += [ "default_task_queue_factory_gcd.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000063 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
64 } else if (is_win && current_os != "winuwp") {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010065 sources += [ "default_task_queue_factory_win.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000066 deps += [ "../../rtc_base:rtc_task_queue_win" ]
67 } else {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010068 sources += [ "default_task_queue_factory_stdlib.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000069 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010070 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010071}
72
Danil Chapovalov2684ab32019-02-26 10:18:08 +010073if (rtc_include_tests) {
74 rtc_source_set("task_queue_default_factory_unittests") {
75 testonly = true
76 sources = [
77 "default_task_queue_factory_unittest.cc",
78 ]
79 deps = [
80 ":default_task_queue_factory",
81 ":task_queue_test",
82 "../../test:test_support",
83 ]
84 }
85}
86
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010087rtc_source_set("global_task_queue_factory") {
Danil Chapovalov87ce8742019-02-01 19:40:11 +010088 # TODO(bugs.webrtc.org/10284): Remove this target when task queue factory
89 # propagated to all components that create TaskQueues.
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010090 visibility = [ "*" ]
91 sources = [
92 "global_task_queue_factory.cc",
93 "global_task_queue_factory.h",
94 ]
95 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +010096 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010097 "../../rtc_base:checks",
98 ]
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010099
100 if (build_with_chromium) {
101 # Chromium uses link-time injection of the CreateDefaultTaskQueueFactory
Danil Chapovaloveffdfe22019-03-09 22:01:27 +0100102 deps += [ "../../../webrtc_overrides:task_queue_impl" ]
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100103 sources += [ "default_task_queue_factory.h" ]
104 } else {
105 deps += [ ":default_task_queue_factory" ]
106 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100107}