blob: 0129512ae873ec240083bf07e381a38f391bbe0c [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 Chapovalovd00405f2019-02-25 15:06:13 +010031# TODO(danilchap): Remove this empty target when downstream project stop depending on it.
32rtc_source_set("task_queue_factory") {
33 visibility = [ "*" ]
34}
35
Danil Chapovalov33b716f2019-01-22 18:15:37 +010036rtc_source_set("task_queue_test") {
37 visibility = [ "*" ]
38 testonly = true
39 sources = [
40 "task_queue_test.cc",
41 "task_queue_test.h",
42 ]
43 deps = [
44 ":task_queue",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010045 "../../rtc_base:rtc_event",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010046 "../../rtc_base:timeutils",
Danil Chapovalov3b548dd2019-03-01 14:58:44 +010047 "../../rtc_base/task_utils:to_queued_task",
Danil Chapovalov33b716f2019-01-22 18:15:37 +010048 "../../test:test_support",
49 "//third_party/abseil-cpp/absl/memory",
50 "//third_party/abseil-cpp/absl/strings",
51 ]
52}
53
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010054rtc_source_set("default_task_queue_factory") {
Danil Chapovalov2684ab32019-02-26 10:18:08 +010055 visibility = [ "*" ]
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010056 sources = [
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010057 "default_task_queue_factory.h",
58 ]
59 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +010060 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010061 ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010062
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000063 if (rtc_enable_libevent) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010064 sources += [ "default_task_queue_factory_libevent.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000065 deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
66 } else if (is_mac || is_ios) {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010067 sources += [ "default_task_queue_factory_gcd.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000068 deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
69 } else if (is_win && current_os != "winuwp") {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010070 sources += [ "default_task_queue_factory_win.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000071 deps += [ "../../rtc_base:rtc_task_queue_win" ]
72 } else {
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +010073 sources += [ "default_task_queue_factory_stdlib.cc" ]
Mirko Bonadeia9cfa472019-02-24 09:17:21 +000074 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
Danil Chapovalov87ce8742019-02-01 19:40:11 +010075 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010076}
77
Danil Chapovalov2684ab32019-02-26 10:18:08 +010078if (rtc_include_tests) {
79 rtc_source_set("task_queue_default_factory_unittests") {
80 testonly = true
81 sources = [
82 "default_task_queue_factory_unittest.cc",
83 ]
84 deps = [
85 ":default_task_queue_factory",
86 ":task_queue_test",
87 "../../test:test_support",
88 ]
89 }
90}
91
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010092rtc_source_set("global_task_queue_factory") {
Danil Chapovalov87ce8742019-02-01 19:40:11 +010093 # TODO(bugs.webrtc.org/10284): Remove this target when task queue factory
94 # propagated to all components that create TaskQueues.
Danil Chapovalovbaaf9112019-01-18 10:09:40 +010095 visibility = [ "*" ]
96 sources = [
97 "global_task_queue_factory.cc",
98 "global_task_queue_factory.h",
99 ]
100 deps = [
Danil Chapovalovd00405f2019-02-25 15:06:13 +0100101 ":task_queue",
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100102 "../../rtc_base:checks",
103 ]
Danil Chapovalov07a4f2b2019-03-05 19:58:28 +0100104
105 if (build_with_chromium) {
106 # Chromium uses link-time injection of the CreateDefaultTaskQueueFactory
107 sources += [ "default_task_queue_factory.h" ]
108 } else {
109 deps += [ ":default_task_queue_factory" ]
110 }
Danil Chapovalovbaaf9112019-01-18 10:09:40 +0100111}