blob: c0648b77ea213424bd51d664f274decac1e27c75 [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 Chapovalov47cf5ea2019-02-19 20:20:16 +010024 "//third_party/abseil-cpp/absl/base:config",
Danil Chapovalov348b08a2019-01-17 13:07:25 +010025 "//third_party/abseil-cpp/absl/base:core_headers",
26 "//third_party/abseil-cpp/absl/strings",
Danil Chapovalov959e9b62019-01-14 14:29:18 +010027 ]
28}
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010029
Danil Chapovalovd00405f2019-02-25 15:06:13 +010030# TODO(danilchap): Remove this empty target when downstream project stop depending on it.
31rtc_source_set("task_queue_factory") {
32 visibility = [ "*" ]
33}
34
Danil Chapovalov33b716f2019-01-22 18:15:37 +010035rtc_source_set("task_queue_test") {
36 visibility = [ "*" ]
37 testonly = true
38 sources = [
39 "task_queue_test.cc",
40 "task_queue_test.h",
41 ]
42 deps = [
43 ":task_queue",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010044 "../../rtc_base:rtc_event",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010045 "../../rtc_base:timeutils",
Danil Chapovalov3b548dd2019-03-01 14:58:44 +010046 "../../rtc_base/task_utils:to_queued_task",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010047 "../../test:test_support",
48 "//third_party/abseil-cpp/absl/memory",
49 "//third_party/abseil-cpp/absl/strings",
50 ]
51}
52
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010053rtc_source_set("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010054 visibility = [ "*" ]
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010055 sources = [
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010056 "default_task_queue_factory.h",
57 ]
58 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +010059 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010060 ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010061
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000062 if (rtc_enable_libevent) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010063 sources += [ "default_task_queue_factory_libevent.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000064 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
65 } else if (is_mac || is_ios) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010066 sources += [ "default_task_queue_factory_gcd.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000067 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
68 } else if (is_win && current_os != "winuwp") {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010069 sources += [ "default_task_queue_factory_win.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000070 deps += [ "../../rtc_base:rtc_task_queue_win" ]
71 } else {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010072 sources += [ "default_task_queue_factory_stdlib.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000073 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010074 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010075}
76
Danil Chapovalov2684ab32019-02-26 10:18:08 +010077if (rtc_include_tests) {
78 rtc_source_set("task_queue_default_factory_unittests") {
79 testonly = true
80 sources = [
81 "default_task_queue_factory_unittest.cc",
82 ]
83 deps = [
84 ":default_task_queue_factory",
85 ":task_queue_test",
86 "../../test:test_support",
87 ]
88 }
89}
90
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010091rtc_source_set("global_task_queue_factory") {
Danil Chapovalov87ce8742019-02-01 19:40:11 +010092 # TODO(bugs.webrtc.org/10284): Remove this target when task queue factory
93 # propagated to all components that create TaskQueues.
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010094 visibility = [ "*" ]
95 sources = [
96 "global_task_queue_factory.cc",
97 "global_task_queue_factory.h",
98 ]
99 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +0100100 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100101 "../../rtc_base:checks",
102 ]
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100103
104 if (build_with_chromium) {
105 # Chromium uses link-time injection of the CreateDefaultTaskQueueFactory
106 sources += [ "default_task_queue_factory.h" ]
107 } else {
108 deps += [ ":default_task_queue_factory" ]
109 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100110}