BUILD.gn (5142B)
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 9 import("../../webrtc.gni") 10 11 rtc_library("task_queue") { 12 visibility = [ "*" ] 13 sources = [ 14 "task_queue_base.cc", 15 "task_queue_base.h", 16 "task_queue_factory.h", 17 ] 18 19 deps = [ 20 "..:location", 21 "../../rtc_base:checks", 22 "../../rtc_base:macromagic", 23 "../../rtc_base/system:rtc_export", 24 "../units:time_delta", 25 "//third_party/abseil-cpp/absl/base:config", 26 "//third_party/abseil-cpp/absl/base:core_headers", 27 "//third_party/abseil-cpp/absl/functional:any_invocable", 28 "//third_party/abseil-cpp/absl/strings:string_view", 29 ] 30 } 31 32 # Mozilla - we want to ensure that rtc_include_tests is set to false 33 # to guarantee that default_task_queue_factory is not used so we 34 # know that remaining win32k code in task_queue_win.cc is not built. 35 # See Bug 1797161 for more info. 36 assert(!rtc_include_tests, "Mozilla - verify rtc_include_tests is off") 37 if (rtc_include_tests) { 38 rtc_library("task_queue_test") { 39 visibility = [ "*" ] 40 testonly = true 41 sources = [ 42 "task_queue_test.cc", 43 "task_queue_test.h", 44 ] 45 46 check_includes = false # no-presubmit-check TODO(bugs.webrtc.org/9419) 47 if (build_with_chromium) { 48 visibility = [] 49 visibility = webrtc_default_visibility 50 visibility += [ 51 # This is the only Chromium targets that can depend on this. The reason 52 # behind this is the fact that these are 'testonly' targets and as such 53 # it cannot be part of the WebRTC component. 54 "//components/webrtc:unit_tests", 55 "//third_party/blink/renderer/platform:blink_platform_unittests_sources", 56 ] 57 58 # Don't depend on WebRTC code outside of webrtc_overrides:webrtc_component 59 # because this will break the WebRTC component build in Chromium. 60 deps = [ 61 "../../../webrtc_overrides:webrtc_component", 62 "../../test:test_support", 63 "//third_party/abseil-cpp/absl/cleanup", 64 "//third_party/abseil-cpp/absl/strings", 65 ] 66 } else { 67 deps = [ 68 ":default_task_queue_factory", 69 ":task_queue", 70 "../../api:field_trials_view", 71 "../../api:make_ref_counted", 72 "../../api:ref_count", 73 "../../api/units:time_delta", 74 "../../rtc_base:refcount", 75 "../../rtc_base:rtc_event", 76 "../../rtc_base:timeutils", 77 "../../test:test_support", 78 "//third_party/abseil-cpp/absl/cleanup", 79 "//third_party/abseil-cpp/absl/strings", 80 ] 81 } 82 } 83 } 84 85 rtc_library("default_task_queue_factory") { 86 # Mozilla - disable this entire target to avoid inclusion of code we want 87 # to avoid. Better here than trying to wack-a-mole for places that list 88 # it as a dependency. 89 if (!build_with_mozilla) { 90 visibility = [ "*" ] 91 92 # Internally webrtc shouldn't rely on any specific TaskQueue implementation 93 # and should create TaskQueue using TaskQueueFactory interface. 94 # TaskQueueFactory interface can be propagated with Environment. 95 poisonous = [ "environment_construction" ] 96 sources = [ "default_task_queue_factory.h" ] 97 deps = [ 98 ":task_queue", 99 "../../api:field_trials_view", 100 "../../rtc_base/memory:always_valid_pointer", 101 ] 102 103 if (is_mac || is_ios) { 104 sources += [ "default_task_queue_factory_gcd.cc" ] 105 deps += [ "../../rtc_base:rtc_task_queue_gcd" ] 106 } else if (is_win && current_os != "winuwp" && !build_with_chromium) { 107 sources += [ "default_task_queue_factory_win.cc" ] 108 deps += [ "../../rtc_base:rtc_task_queue_win" ] 109 } else { 110 sources += [ "default_task_queue_factory_stdlib.cc" ] 111 deps += [ "../../rtc_base:rtc_task_queue_stdlib" ] 112 } 113 } # of if (!build_with_mozilla) { 114 } 115 116 rtc_library("pending_task_safety_flag") { 117 visibility = [ "*" ] 118 sources = [ 119 "pending_task_safety_flag.cc", 120 "pending_task_safety_flag.h", 121 ] 122 deps = [ 123 ":task_queue", 124 "../../api:refcountedbase", 125 "../../api:scoped_refptr", 126 "../../api:sequence_checker", 127 "../../rtc_base:checks", 128 "../../rtc_base/system:no_unique_address", 129 "../../rtc_base/system:rtc_export", 130 "//third_party/abseil-cpp/absl/base:nullability", 131 "//third_party/abseil-cpp/absl/functional:any_invocable", 132 ] 133 } 134 135 if (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 ":task_queue", 152 "..:scoped_refptr", 153 "../../rtc_base:checks", 154 "../../rtc_base:logging", 155 "../../rtc_base:rtc_event", 156 "../../rtc_base:task_queue_for_test", 157 "../../test:test_support", 158 ] 159 } 160 }