Make ProcessThread be a TaskQueue implementation
That would allow to switch components from relying on ProcessThreads to relying on TaskQueue one by one, without introducing new threads. Bug: webrtc:6289 Change-Id: I18fe5d679d4d4d0ddf4a11900c9814eb570284d6 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/167533 Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Reviewed-by: Sebastian Jansson <srte@webrtc.org> Cr-Commit-Position: refs/heads/master@{#30631}
This commit is contained in:
committed by
Commit Bot
parent
a7382f7879
commit
14273de88b
@ -14,6 +14,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include "api/task_queue/queued_task.h"
|
||||
#include "api/task_queue/task_queue_test.h"
|
||||
#include "modules/include/module.h"
|
||||
#include "rtc_base/location.h"
|
||||
#include "rtc_base/time_utils.h"
|
||||
@ -310,4 +311,21 @@ TEST(ProcessThreadImpl, PostTask) {
|
||||
thread.Stop();
|
||||
}
|
||||
|
||||
class ProcessThreadFactory : public TaskQueueFactory {
|
||||
public:
|
||||
~ProcessThreadFactory() override = default;
|
||||
std::unique_ptr<TaskQueueBase, TaskQueueDeleter> CreateTaskQueue(
|
||||
absl::string_view name,
|
||||
Priority priority) const override {
|
||||
ProcessThreadImpl* process_thread = new ProcessThreadImpl("thread");
|
||||
process_thread->Start();
|
||||
return std::unique_ptr<TaskQueueBase, TaskQueueDeleter>(process_thread);
|
||||
}
|
||||
};
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(
|
||||
ProcessThread,
|
||||
TaskQueueTest,
|
||||
testing::Values(std::make_unique<ProcessThreadFactory>));
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user