#include "common/WorkerThread.h"
#include "common/angleutils.h"
#include "common/system_utils.h"
#if !defined(ANGLE_STD_ASYNC_WORKERS) && !defined(ANGLE_ENABLE_WINDOWS_UWP)
#define ANGLE_STD_ASYNC_WORKERS …
#endif
#if ANGLE_DELEGATE_WORKERS || ANGLE_STD_ASYNC_WORKERS
# include <future>
# include <queue>
# include <thread>
#endif
namespace angle
{
WaitableEvent::WaitableEvent() = default;
WaitableEvent::~WaitableEvent() = default;
void WaitableEventDone::wait() { … }
bool WaitableEventDone::isReady()
{ … }
void AsyncWaitableEvent::markAsReady()
{ … }
void AsyncWaitableEvent::wait()
{ … }
bool AsyncWaitableEvent::isReady()
{ … }
WorkerThreadPool::WorkerThreadPool() = default;
WorkerThreadPool::~WorkerThreadPool() = default;
class SingleThreadedWorkerPool final : public WorkerThreadPool
{ … };
std::shared_ptr<WaitableEvent> SingleThreadedWorkerPool::postWorkerTask(
const std::shared_ptr<Closure> &task)
{ … }
bool SingleThreadedWorkerPool::isAsync()
{ … }
#if ANGLE_STD_ASYNC_WORKERS
class AsyncWorkerPool final : public WorkerThreadPool
{ … };
AsyncWorkerPool::AsyncWorkerPool(size_t numThreads) : … { … }
AsyncWorkerPool::~AsyncWorkerPool()
{ … }
void AsyncWorkerPool::createThreads()
{ … }
std::shared_ptr<WaitableEvent> AsyncWorkerPool::postWorkerTask(const std::shared_ptr<Closure> &task)
{ … }
void AsyncWorkerPool::threadLoop()
{ … }
bool AsyncWorkerPool::isAsync()
{ … }
#endif
#if ANGLE_DELEGATE_WORKERS
class DelegateWorkerPool final : public WorkerThreadPool
{ … };
class DelegateWorkerTask
{ … };
ANGLE_NO_SANITIZE_CFI_ICALL
std::shared_ptr<WaitableEvent> DelegateWorkerPool::postWorkerTask(
const std::shared_ptr<Closure> &task)
{ … }
bool DelegateWorkerPool::isAsync()
{ … }
#endif
std::shared_ptr<WorkerThreadPool> WorkerThreadPool::Create(size_t numThreads,
PlatformMethods *platform)
{ … }
}