#include "content/public/renderer/render_thread.h"
#include "base/no_destructor.h"
#include "base/threading/thread_checker_impl.h"
#include "third_party/abseil-cpp/absl/base/attributes.h"
namespace content {
namespace {
ABSL_CONST_INIT thread_local RenderThread* render_thread = nullptr;
static const base::ThreadCheckerImpl& GetThreadChecker() {
static base::NoDestructor<base::ThreadCheckerImpl> checker;
return *checker;
}
}
RenderThread* RenderThread::Get() {
return render_thread;
}
bool RenderThread::IsMainThread() {
return GetThreadChecker().CalledOnValidThread();
}
RenderThread::RenderThread() : resetter_(&render_thread, this) {}
RenderThread::~RenderThread() = default;
}