chromium/third_party/angle/src/common/WorkerThread.h

//
// Copyright 2016 The ANGLE 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.
//
// WorkerThread:
//   Asychronous tasks/threads for ANGLE, similar to a TaskRunner in Chromium.
//   Can be implemented as different targets, depending on platform.
//

#ifndef COMMON_WORKER_THREAD_H_
#define COMMON_WORKER_THREAD_H_

#include <array>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <vector>

#include "common/debug.h"
#include "platform/PlatformMethods.h"

namespace angle
{

class WorkerThreadPool;

// A callback function with no return value and no arguments.
class Closure
{};

// An event that we can wait on, useful for joining worker threads.
class WaitableEvent : angle::NonCopyable
{};

// A waitable event that is always ready.
class WaitableEventDone final : public WaitableEvent
{};

// A waitable event that can be completed asynchronously
class AsyncWaitableEvent final : public WaitableEvent
{};

// Request WorkerThreads from the WorkerThreadPool. Each pool can keep worker threads around so
// we avoid the costly spin up and spin down time.
class WorkerThreadPool : angle::NonCopyable
{};

}  // namespace angle

#endif  // COMMON_WORKER_THREAD_H_