mirror of
https://github.com/mollyim/webrtc.git
synced 2025-05-13 22:00:47 +01:00
Revert "Remove TaskQueue constructor that uses GlobalTaskQueueFactory"
This reverts commit 7b7485b796
.
Reason for revert: Breaks Chrome autoroll
video/video_stream_decoder_impl.cc:28:7: error: no matching constructor for initialization of 'rtc::TaskQueue'
bookkeeping_queue_("video_stream_decoder_bookkeeping_queue"),
Original change's description:
> Remove TaskQueue constructor that uses GlobalTaskQueueFactory
>
> Bug: webrtc:10284
> Change-Id: I9547fb7110222ce3a3c2323ae2a004024eab911e
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130471
> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#27464}
TBR=danilchap@webrtc.org,kwiberg@webrtc.org
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: webrtc:10284
Change-Id: I7684f7c7d5501cc910ac9f9daa8ccf6bdb10f8e1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131338
Reviewed-by: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27491}
This commit is contained in:
parent
14d1c9d968
commit
57f2a5485a
6 changed files with 22 additions and 18 deletions
|
@ -479,6 +479,7 @@ rtc_source_set("rtc_task_queue") {
|
||||||
deps = [
|
deps = [
|
||||||
":macromagic",
|
":macromagic",
|
||||||
"../api/task_queue",
|
"../api/task_queue",
|
||||||
|
"../api/task_queue:global_task_queue_factory",
|
||||||
"system:rtc_export",
|
"system:rtc_export",
|
||||||
"task_utils:to_queued_task",
|
"task_utils:to_queued_task",
|
||||||
"//third_party/abseil-cpp/absl/memory",
|
"//third_party/abseil-cpp/absl/memory",
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
*/
|
*/
|
||||||
#include "rtc_base/task_queue.h"
|
#include "rtc_base/task_queue.h"
|
||||||
|
|
||||||
|
#include "api/task_queue/global_task_queue_factory.h"
|
||||||
#include "api/task_queue/task_queue_base.h"
|
#include "api/task_queue/task_queue_base.h"
|
||||||
|
|
||||||
namespace rtc {
|
namespace rtc {
|
||||||
|
@ -17,6 +18,10 @@ TaskQueue::TaskQueue(
|
||||||
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter> task_queue)
|
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter> task_queue)
|
||||||
: impl_(task_queue.release()) {}
|
: impl_(task_queue.release()) {}
|
||||||
|
|
||||||
|
TaskQueue::TaskQueue(const char* queue_name, Priority priority)
|
||||||
|
: TaskQueue(webrtc::GlobalTaskQueueFactory().CreateTaskQueue(queue_name,
|
||||||
|
priority)) {}
|
||||||
|
|
||||||
TaskQueue::~TaskQueue() {
|
TaskQueue::~TaskQueue() {
|
||||||
// There might running task that tries to rescheduler itself to the TaskQueue
|
// There might running task that tries to rescheduler itself to the TaskQueue
|
||||||
// and not yet aware TaskQueue destructor is called.
|
// and not yet aware TaskQueue destructor is called.
|
||||||
|
|
|
@ -80,6 +80,8 @@ class RTC_LOCKABLE RTC_EXPORT TaskQueue {
|
||||||
|
|
||||||
explicit TaskQueue(std::unique_ptr<webrtc::TaskQueueBase,
|
explicit TaskQueue(std::unique_ptr<webrtc::TaskQueueBase,
|
||||||
webrtc::TaskQueueDeleter> task_queue);
|
webrtc::TaskQueueDeleter> task_queue);
|
||||||
|
explicit TaskQueue(const char* queue_name,
|
||||||
|
Priority priority = Priority::NORMAL);
|
||||||
~TaskQueue();
|
~TaskQueue();
|
||||||
|
|
||||||
// Used for DCHECKing the current queue.
|
// Used for DCHECKing the current queue.
|
||||||
|
|
|
@ -15,7 +15,9 @@ rtc_static_library("webrtc_fuzzer_main") {
|
||||||
"webrtc_fuzzer_main.cc",
|
"webrtc_fuzzer_main.cc",
|
||||||
]
|
]
|
||||||
deps = [
|
deps = [
|
||||||
|
"../../api/task_queue:global_task_queue_factory",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
|
"../../rtc_base:rtc_task_queue_stdlib",
|
||||||
"//testing/libfuzzer:libfuzzer_main",
|
"//testing/libfuzzer:libfuzzer_main",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -499,7 +501,6 @@ webrtc_fuzzer_test("audio_processing_fuzzer") {
|
||||||
"../../modules/audio_processing/aec_dump:aec_dump_impl",
|
"../../modules/audio_processing/aec_dump:aec_dump_impl",
|
||||||
"../../rtc_base:rtc_base_approved",
|
"../../rtc_base:rtc_base_approved",
|
||||||
"../../rtc_base:rtc_task_queue",
|
"../../rtc_base:rtc_task_queue",
|
||||||
"../../rtc_base:rtc_task_queue_stdlib",
|
|
||||||
"../../rtc_base:safe_minmax",
|
"../../rtc_base:safe_minmax",
|
||||||
"../../system_wrappers:field_trial",
|
"../../system_wrappers:field_trial",
|
||||||
"//third_party/abseil-cpp/absl/memory",
|
"//third_party/abseil-cpp/absl/memory",
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
#include "rtc_base/arraysize.h"
|
#include "rtc_base/arraysize.h"
|
||||||
#include "rtc_base/numerics/safe_minmax.h"
|
#include "rtc_base/numerics/safe_minmax.h"
|
||||||
#include "rtc_base/task_queue.h"
|
#include "rtc_base/task_queue.h"
|
||||||
#include "rtc_base/task_queue_stdlib.h"
|
|
||||||
#include "system_wrappers/include/field_trial.h"
|
#include "system_wrappers/include/field_trial.h"
|
||||||
#include "test/fuzzers/audio_processing_fuzzer_helper.h"
|
#include "test/fuzzers/audio_processing_fuzzer_helper.h"
|
||||||
#include "test/fuzzers/fuzz_data_helper.h"
|
#include "test/fuzzers/fuzz_data_helper.h"
|
||||||
|
@ -149,19 +148,6 @@ std::unique_ptr<AudioProcessing> CreateApm(test::FuzzDataHelper* fuzz_data,
|
||||||
|
|
||||||
return apm;
|
return apm;
|
||||||
}
|
}
|
||||||
|
|
||||||
TaskQueueFactory* GetTaskQueueFactory() {
|
|
||||||
// Chromium hijacked DefaultTaskQueueFactory with own implementation, but
|
|
||||||
// unable to use it without base::test::ScopedTaskEnvironment. Actual used
|
|
||||||
// task queue implementation shouldn't matter for the purpose of this fuzzer,
|
|
||||||
// so use stdlib implementation: that one is multiplatform.
|
|
||||||
// When bugs.webrtc.org/10284 is resolved and chromium stops hijacking
|
|
||||||
// DefaultTaskQueueFactory, Stdlib can be replaced with default one.
|
|
||||||
static TaskQueueFactory* const factory =
|
|
||||||
CreateTaskQueueStdlibFactory().release();
|
|
||||||
return factory;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void FuzzOneInput(const uint8_t* data, size_t size) {
|
void FuzzOneInput(const uint8_t* data, size_t size) {
|
||||||
|
@ -173,9 +159,9 @@ void FuzzOneInput(const uint8_t* data, size_t size) {
|
||||||
// for field_trial.h. Hence it's created here and not in CreateApm.
|
// for field_trial.h. Hence it's created here and not in CreateApm.
|
||||||
std::string field_trial_string = "";
|
std::string field_trial_string = "";
|
||||||
|
|
||||||
rtc::TaskQueue worker_queue(GetTaskQueueFactory()->CreateTaskQueue(
|
std::unique_ptr<rtc::TaskQueue> worker_queue(
|
||||||
"rtc-low-prio", rtc::TaskQueue::Priority::LOW));
|
new rtc::TaskQueue("rtc-low-prio", rtc::TaskQueue::Priority::LOW));
|
||||||
auto apm = CreateApm(&fuzz_data, &field_trial_string, &worker_queue);
|
auto apm = CreateApm(&fuzz_data, &field_trial_string, worker_queue.get());
|
||||||
|
|
||||||
if (apm) {
|
if (apm) {
|
||||||
FuzzAudioProcessing(&fuzz_data, std::move(apm));
|
FuzzAudioProcessing(&fuzz_data, std::move(apm));
|
||||||
|
|
|
@ -12,7 +12,9 @@
|
||||||
// It's intended to set sane defaults, such as removing logging for further
|
// It's intended to set sane defaults, such as removing logging for further
|
||||||
// fuzzing efficiency.
|
// fuzzing efficiency.
|
||||||
|
|
||||||
|
#include "api/task_queue/global_task_queue_factory.h"
|
||||||
#include "rtc_base/logging.h"
|
#include "rtc_base/logging.h"
|
||||||
|
#include "rtc_base/task_queue_stdlib.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
bool g_initialized = false;
|
bool g_initialized = false;
|
||||||
|
@ -26,6 +28,13 @@ void InitializeWebRtcFuzzDefaults() {
|
||||||
rtc::LogMessage::LogToDebug(rtc::LS_NONE);
|
rtc::LogMessage::LogToDebug(rtc::LS_NONE);
|
||||||
#endif // !defined(WEBRTC_CHROMIUM_BUILD)
|
#endif // !defined(WEBRTC_CHROMIUM_BUILD)
|
||||||
|
|
||||||
|
// Chromium hijacked DefaultTaskQueueFactory with own implementation, but
|
||||||
|
// unable to use it without base::test::ScopedTaskEnvironment. Actual used
|
||||||
|
// task queue implementation shouldn't matter for the purpose of the fuzzers,
|
||||||
|
// so use stdlib implementation: that one is multiplatform. This is a
|
||||||
|
// temporary solution until bugs.webrtc.org/10284 is resolved.
|
||||||
|
webrtc::SetGlobalTaskQueueFactory(webrtc::CreateTaskQueueStdlibFactory());
|
||||||
|
|
||||||
g_initialized = true;
|
g_initialized = true;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
Loading…
Reference in a new issue