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 "task_queue_base.h", 15 "task_queue_factory.h", 16 ] 17 sources = [ "task_queue_base.cc" ] 18 19 deps = [ 20 "../../rtc_base:checks", 21 "../../rtc_base:macromagic", 22 "../../rtc_base/system:rtc_export", 23 "../units:time_delta", 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/functional:any_invocable", 29 "//third_party/abseil-cpp/absl/strings", 30 ] 31} 32 33rtc_library("task_queue_test") { 34 visibility = [ "*" ] 35 testonly = true 36 sources = [ 37 "task_queue_test.cc", 38 "task_queue_test.h", 39 ] 40 41 check_includes = false # no-presubmit-check TODO(bugs.webrtc.org/9419) 42 if (build_with_chromium) { 43 visibility = [] 44 visibility = webrtc_default_visibility 45 visibility += [ 46 # This is the only Chromium targets that can depend on this. The reason 47 # behind this is the fact that these are 'testonly' targets and as such 48 # it cannot be part of the WebRTC component. 49 "//components/webrtc:unit_tests", 50 "//third_party/blink/renderer/platform:blink_platform_unittests_sources", 51 ] 52 53 # Don't depend on WebRTC code outside of webrtc_overrides:webrtc_component 54 # because this will break the WebRTC component build in Chromium. 55 deps = [ 56 "../../../webrtc_overrides:webrtc_component", 57 "../../test:test_support", 58 ] 59 absl_deps = [ 60 "//third_party/abseil-cpp/absl/cleanup", 61 "//third_party/abseil-cpp/absl/strings", 62 ] 63 } else { 64 deps = [ 65 ":default_task_queue_factory", 66 ":task_queue", 67 "../../api:field_trials_view", 68 "../../api/units:time_delta", 69 "../../rtc_base:refcount", 70 "../../rtc_base:rtc_event", 71 "../../rtc_base:timeutils", 72 "../../test:test_support", 73 ] 74 absl_deps = [ 75 "//third_party/abseil-cpp/absl/cleanup", 76 "//third_party/abseil-cpp/absl/strings", 77 ] 78 } 79} 80 81rtc_library("default_task_queue_factory") { 82 visibility = [ "*" ] 83 if (!is_ios && !is_android) { 84 poisonous = [ "default_task_queue" ] 85 } 86 sources = [ "default_task_queue_factory.h" ] 87 deps = [ 88 ":task_queue", 89 "../../api:field_trials_view", 90 "../../rtc_base/memory:always_valid_pointer", 91 ] 92 93 if (rtc_enable_libevent) { 94 if (is_android) { 95 sources += 96 [ "default_task_queue_factory_stdlib_or_libevent_experiment.cc" ] 97 deps += [ 98 "../../api/transport:field_trial_based_config", 99 "../../rtc_base:logging", 100 "../../rtc_base:rtc_task_queue_libevent", 101 "../../rtc_base:rtc_task_queue_stdlib", 102 ] 103 } else { 104 sources += [ "default_task_queue_factory_libevent.cc" ] 105 deps += [ "../../rtc_base:rtc_task_queue_libevent" ] 106 } 107 } else if (is_mac || is_ios) { 108 sources += [ "default_task_queue_factory_gcd.cc" ] 109 deps += [ "../../rtc_base:rtc_task_queue_gcd" ] 110 } else if (is_win && current_os != "winuwp") { 111 sources += [ "default_task_queue_factory_win.cc" ] 112 deps += [ "../../rtc_base:rtc_task_queue_win" ] 113 } else { 114 sources += [ "default_task_queue_factory_stdlib.cc" ] 115 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ] 116 } 117} 118 119rtc_library("pending_task_safety_flag") { 120 visibility = [ "*" ] 121 sources = [ 122 "pending_task_safety_flag.cc", 123 "pending_task_safety_flag.h", 124 ] 125 deps = [ 126 "../../api:refcountedbase", 127 "../../api:scoped_refptr", 128 "../../api:sequence_checker", 129 "../../rtc_base:checks", 130 "../../rtc_base/system:no_unique_address", 131 ] 132 absl_deps = [ "//third_party/abseil-cpp/absl/functional:any_invocable" ] 133} 134 135if (rtc_include_tests) { 136 rtc_library("task_queue_default_factory_unittests") { 137 testonly = true 138 sources = [ "default_task_queue_factory_unittest.cc" ] 139 deps = [ 140 ":default_task_queue_factory", 141 ":task_queue_test", 142 "../../test:test_support", 143 ] 144 } 145 146 rtc_library("pending_task_safety_flag_unittests") { 147 testonly = true 148 sources = [ "pending_task_safety_flag_unittest.cc" ] 149 deps = [ 150 ":pending_task_safety_flag", 151 "../../rtc_base:logging", 152 "../../rtc_base:rtc_event", 153 "../../rtc_base:rtc_task_queue", 154 "../../rtc_base:task_queue_for_test", 155 "../../test:test_support", 156 ] 157 } 158} 159