#include "include/core/SkExecutor.h"
#include "include/private/base/SkMutex.h"
#include "include/private/base/SkSemaphore.h"
#include "include/private/base/SkTArray.h"
#include "src/base/SkNoDestructor.h"
#include <deque>
#include <thread>
#include <utility>
usingnamespaceskia_private;
#if defined(SK_BUILD_FOR_WIN)
#include "src/base/SkLeanWindows.h"
static int num_cores() {
SYSTEM_INFO sysinfo;
GetNativeSystemInfo(&sysinfo);
return (int)sysinfo.dwNumberOfProcessors;
}
#else
#include <unistd.h>
static int num_cores() { … }
#endif
SkExecutor::~SkExecutor() { … }
class SkTrivialExecutor final : public SkExecutor { … };
static SkExecutor& trivial_executor() { … }
static SkExecutor* gDefaultExecutor = …;
SkExecutor& SkExecutor::GetDefault() { … }
void SkExecutor::SetDefault(SkExecutor* executor) { … }
static inline std::function<void(void)> pop(std::deque<std::function<void(void)>>* list) { … }
static inline std::function<void(void)> pop(TArray<std::function<void(void)>>* list) { … }
template <typename WorkList>
class SkThreadPool final : public SkExecutor { … };
std::unique_ptr<SkExecutor> SkExecutor::MakeFIFOThreadPool(int threads, bool allowBorrowing) { … }
std::unique_ptr<SkExecutor> SkExecutor::MakeLIFOThreadPool(int threads, bool allowBorrowing) { … }