1# 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_library("task_queue") {
12  visibility = [ "*" ]
13  public = [
14    "queued_task.h",
15    "task_queue_base.h",
16    "task_queue_factory.h",
17  ]
18  sources = [ "task_queue_base.cc" ]
19
20  deps = [
21    "../../rtc_base:checks",
22    "../../rtc_base:macromagic",
23    "../../rtc_base/system:rtc_export",
24  ]
25  absl_deps = [
26    "//third_party/abseil-cpp/absl/base:config",
27    "//third_party/abseil-cpp/absl/base:core_headers",
28    "//third_party/abseil-cpp/absl/strings",
29  ]
30}
31
32rtc_library("task_queue_test") {
33  visibility = [ "*" ]
34  testonly = true
35  sources = [
36    "task_queue_test.cc",
37    "task_queue_test.h",
38  ]
39
40  check_includes = false  # no-presubmit-check TODO(bugs.webrtc.org/9419)
41  if (build_with_chromium) {
42    visibility = []
43    visibility = webrtc_default_visibility
44    visibility += [
45      # This is the only Chromium target that can depend on this. The reason
46      # behind this is the fact that this is a 'testonly' target and as such
47      # it cannot be part of the WebRTC component.
48      "//third_party/blink/renderer/platform:blink_platform_unittests_sources",
49    ]
50
51    # Don't depend on WebRTC code outside of webrtc_overrides:webrtc_component
52    # because this will break the WebRTC component build in Chromium.
53    deps = [
54      "../../../webrtc_overrides:webrtc_component",
55      "../../test:test_support",
56    ]
57    absl_deps = [
58      "//third_party/abseil-cpp/absl/memory",
59      "//third_party/abseil-cpp/absl/strings",
60    ]
61  } else {
62    deps = [
63      ":task_queue",
64      "../../rtc_base:refcount",
65      "../../rtc_base:rtc_event",
66      "../../rtc_base:timeutils",
67      "../../rtc_base/task_utils:to_queued_task",
68      "../../test:test_support",
69    ]
70    absl_deps = [
71      "//third_party/abseil-cpp/absl/memory",
72      "//third_party/abseil-cpp/absl/strings",
73    ]
74  }
75}
76
77rtc_library("default_task_queue_factory") {
78  visibility = [ "*" ]
79  if (!is_ios && !is_android) {
80    poisonous = [ "default_task_queue" ]
81  }
82  sources = [ "default_task_queue_factory.h" ]
83  deps = [ ":task_queue" ]
84
85  if (rtc_enable_libevent) {
86    sources += [ "default_task_queue_factory_libevent.cc" ]
87    deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
88  } else if (is_mac || is_ios) {
89    sources += [ "default_task_queue_factory_gcd.cc" ]
90    deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
91  } else if (is_win && current_os != "winuwp") {
92    sources += [ "default_task_queue_factory_win.cc" ]
93    deps += [ "../../rtc_base:rtc_task_queue_win" ]
94  } else {
95    sources += [ "default_task_queue_factory_stdlib.cc" ]
96    deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
97  }
98}
99
100if (rtc_include_tests) {
101  rtc_library("task_queue_default_factory_unittests") {
102    testonly = true
103    sources = [ "default_task_queue_factory_unittest.cc" ]
104    deps = [
105      ":default_task_queue_factory",
106      ":task_queue_test",
107      "../../test:test_support",
108    ]
109  }
110}
111