Connect global task queue factory and rtc::TaskQueue

This cl allows to overwrite TaskQueue implementation
by depending on and setting the global task queue factory.

Bug: webrtc:10191
Change-Id: I69ceb139d00078d3be90eeb4e240758b88829c20
Reviewed-on: https://webrtc-review.googlesource.com/c/118060
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Commit-Queue: Danil Chapovalov <danilchap@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26345}
This commit is contained in:
Danil Chapovalov
2019-01-21 13:52:59 +01:00
committed by Commit Bot
parent 443760d4ba
commit b4c6d1e6d9
7 changed files with 164 additions and 7 deletions

View File

@ -0,0 +1,40 @@
/*
* Copyright 2019 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.
*/
#ifndef API_TASK_QUEUE_TASK_QUEUE_IMPL_H_
#define API_TASK_QUEUE_TASK_QUEUE_IMPL_H_
#include <memory>
#include "api/task_queue/queued_task.h"
#include "rtc_base/task_queue.h"
// TODO(danilchap): Remove Impl and dependency on rtc::TaskQueue when custom
// implementations switch to use global factories that creates TaskQueue
// instead of using link-time injection.
class rtc::TaskQueue::Impl {
public:
virtual void Delete() = 0;
virtual void PostTask(std::unique_ptr<QueuedTask> task) = 0;
virtual void PostDelayedTask(std::unique_ptr<QueuedTask> task,
uint32_t milliseconds) = 0;
void AddRef();
void Release();
protected:
virtual ~Impl() = default;
private:
friend class rtc::TaskQueue;
rtc::TaskQueue* task_queue_ = nullptr;
};
#endif // API_TASK_QUEUE_TASK_QUEUE_IMPL_H_