#pragma once
#include <stdint.h>
#include <wtf/Forward.h>
#include <wtf/Function.h>
#include <wtf/Optional.h>
#include <wtf/ThreadingPrimitives.h>
namespace WTF {
class PrintStream;
class Thread;
WTF_EXPORT_PRIVATE void initializeMainThread();
WTF_EXPORT_PRIVATE void callOnMainThread(Function<void()>&&);
WTF_EXPORT_PRIVATE void callOnMainThreadAndWait(Function<void()>&&);
#if PLATFORM(COCOA)
WTF_EXPORT_PRIVATE void callOnWebThreadOrDispatchAsyncOnMainThread(void (^block)());
#endif
WTF_EXPORT_PRIVATE void setMainThreadCallbacksPaused(bool paused);
WTF_EXPORT_PRIVATE bool isMainThread();
WTF_EXPORT_PRIVATE bool isMainThreadIfInitialized();
WTF_EXPORT_PRIVATE bool canAccessThreadLocalDataForThread(Thread&);
#if USE(WEB_THREAD)
WTF_EXPORT_PRIVATE bool isWebThread();
WTF_EXPORT_PRIVATE bool isUIThread();
WTF_EXPORT_PRIVATE void initializeWebThread();
WTF_EXPORT_PRIVATE void initializeApplicationUIThread();
void initializeWebThreadPlatform();
#else
inline bool isWebThread() { return isMainThread(); }
inline bool isUIThread() { return isMainThread(); }
#endif // USE(WEB_THREAD)
WTF_EXPORT_PRIVATE void initializeGCThreads();
enum class GCThreadType {
Main,
Helper
};
void printInternal(PrintStream&, GCThreadType);
WTF_EXPORT_PRIVATE void registerGCThread(GCThreadType);
WTF_EXPORT_PRIVATE Optional<GCThreadType> mayBeGCThread();
WTF_EXPORT_PRIVATE bool isMainThreadOrGCThread();
void initializeMainThreadPlatform();
void scheduleDispatchFunctionsOnMainThread();
void dispatchFunctionsFromMainThread();
#if OS(DARWIN) && !USE(GLIB)
#if !USE(WEB_THREAD)
WTF_EXPORT_PRIVATE void initializeMainThreadToProcessMainThread();
#endif // !USE(WEB_THREAD)
void initializeMainThreadToProcessMainThreadPlatform();
#endif
}
using WTF::GCThreadType;
using WTF::callOnMainThread;
using WTF::callOnMainThreadAndWait;
using WTF::canAccessThreadLocalDataForThread;
using WTF::isMainThread;
using WTF::isMainThreadOrGCThread;
using WTF::isUIThread;
using WTF::isWebThread;
using WTF::mayBeGCThread;
using WTF::setMainThreadCallbacksPaused;
#if PLATFORM(COCOA)
using WTF::callOnWebThreadOrDispatchAsyncOnMainThread;
#endif
#if USE(WEB_THREAD)
using WTF::initializeWebThread;
using WTF::initializeApplicationUIThread;
#endif