#include "third_party/webrtc_overrides/task_queue_factory.h"
#include <map>
#include <memory>
#include "base/containers/flat_map.h"
#include "base/functional/bind.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/synchronization/lock.h"
#include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "base/thread_annotations.h"
#include "base/time/time.h"
#include "third_party/abseil-cpp/absl/functional/any_invocable.h"
#include "third_party/webrtc/api/task_queue/task_queue_base.h"
#include "third_party/webrtc/api/task_queue/task_queue_factory.h"
#include "third_party/webrtc/api/units/time_delta.h"
#include "third_party/webrtc_overrides/api/location.h"
#include "third_party/webrtc_overrides/coalesced_tasks.h"
#include "third_party/webrtc_overrides/metronome_source.h"
#include "third_party/webrtc_overrides/timer_based_tick_provider.h"
namespace blink {
class WebRtcTaskQueue : public base::RefCountedThreadSafe<WebRtcTaskQueue>,
public webrtc::TaskQueueBase { … };
WebRtcTaskQueue::WebRtcTaskQueue(base::TaskTraits traits)
: … { … }
void WebRtcTaskQueue::Delete() { … }
void WebRtcTaskQueue::RunTask(absl::AnyInvocable<void() &&> task) { … }
void WebRtcTaskQueue::PostTaskImpl(absl::AnyInvocable<void() &&> task,
const PostTaskTraits& traits,
const webrtc::Location& location) { … }
void WebRtcTaskQueue::MaybeRunCoalescedTasks(
base::TimeTicks scheduled_time_now) { … }
void WebRtcTaskQueue::PostDelayedTaskImpl(absl::AnyInvocable<void() &&> task,
webrtc::TimeDelta delay,
const PostDelayedTaskTraits& traits,
const webrtc::Location& location) { … }
namespace {
base::TaskTraits TaskQueuePriority2Traits(
webrtc::TaskQueueFactory::Priority priority) { … }
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter>
CreateTaskQueueHelper(webrtc::TaskQueueFactory::Priority priority) { … }
class WebrtcTaskQueueFactory final : public webrtc::TaskQueueFactory { … };
}
}
std::unique_ptr<webrtc::TaskQueueFactory> CreateWebRtcTaskQueueFactory() { … }
std::unique_ptr<webrtc::TaskQueueBase, webrtc::TaskQueueDeleter>
CreateWebRtcTaskQueue(webrtc::TaskQueueFactory::Priority priority) { … }