Files
platform-external-webrtc/api/task_queue/BUILD.gn
Danil Chapovalov f504dd305d Rewrite TaskQueueTest.PostALot
avoid waiting while executing a Task to discourage blocking.

fix accessing tasks_clean_up counter since after TaskQueue is destroyed,
it doesn't guarantee sequential execution of the destructors, nor
that all pending tasks are destroyed at that moment.
Instead verify that all posted tasks will be destroyed eventually.

Bug: None
Change-Id: I4cfc97ac0787fe2d0b9d2f0d712a37ae0ca9e1aa
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/140288
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Niels Moller <nisse@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28208}
2019-06-10 11:00:44 +00:00

109 lines
2.9 KiB
Plaintext

# Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import("../../webrtc.gni")
rtc_source_set("task_queue") {
visibility = [ "*" ]
public = [
"queued_task.h",
"task_queue_base.h",
"task_queue_factory.h",
]
sources = [
"task_queue_base.cc",
]
deps = [
"../../rtc_base:checks",
"../../rtc_base:macromagic",
"//third_party/abseil-cpp/absl/base:config",
"//third_party/abseil-cpp/absl/base:core_headers",
"//third_party/abseil-cpp/absl/strings",
]
}
rtc_source_set("task_queue_test") {
visibility = [ "*" ]
testonly = true
sources = [
"task_queue_test.cc",
"task_queue_test.h",
]
deps = [
":task_queue",
"../../rtc_base:refcount",
"../../rtc_base:rtc_event",
"../../rtc_base:timeutils",
"../../rtc_base/task_utils:to_queued_task",
"../../test:test_support",
"//third_party/abseil-cpp/absl/memory",
"//third_party/abseil-cpp/absl/strings",
]
}
rtc_source_set("default_task_queue_factory") {
visibility = [ "*" ]
sources = [
"default_task_queue_factory.h",
]
deps = [
":task_queue",
]
if (rtc_enable_libevent) {
sources += [ "default_task_queue_factory_libevent.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
} else if (is_mac || is_ios) {
sources += [ "default_task_queue_factory_gcd.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_gcd" ]
} else if (is_win && current_os != "winuwp") {
sources += [ "default_task_queue_factory_win.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_win" ]
} else {
sources += [ "default_task_queue_factory_stdlib.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_stdlib" ]
}
}
if (rtc_include_tests) {
rtc_source_set("task_queue_default_factory_unittests") {
testonly = true
sources = [
"default_task_queue_factory_unittest.cc",
]
deps = [
":default_task_queue_factory",
":task_queue_test",
"../../test:test_support",
]
}
}
rtc_source_set("global_task_queue_factory") {
# TODO(bugs.webrtc.org/10284): Remove this target when task queue factory
# propagated to all components that create TaskQueues.
visibility = [ "*" ]
sources = [
"global_task_queue_factory.cc",
"global_task_queue_factory.h",
]
deps = [
":task_queue",
"../../rtc_base:checks",
]
if (build_with_chromium) {
# Chromium uses link-time injection of the CreateDefaultTaskQueueFactory
deps += [ "../../../webrtc_overrides:task_queue_impl" ]
sources += [ "default_task_queue_factory.h" ]
} else {
deps += [ ":default_task_queue_factory" ]
}
}