本文整理汇总了C++中mozilla::ThreadLocal::initialized方法的典型用法代码示例。如果您正苦于以下问题:C++ ThreadLocal::initialized方法的具体用法?C++ ThreadLocal::initialized怎么用?C++ ThreadLocal::initialized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mozilla::ThreadLocal
的用法示例。
在下文中一共展示了ThreadLocal::initialized方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetStaticGLContext
static void SetStaticGLContext(GLContext* context)
{
if (!sGLContext.initialized()) {
mozilla::DebugOnly<bool> success = sGLContext.init();
MOZ_ASSERT(success);
}
sGLContext.set(context);
}
示例2:
void
NS_SetMainThread()
{
if (!sTLSIsMainThread.initialized()) {
if (!sTLSIsMainThread.init()) {
MOZ_CRASH();
}
sTLSIsMainThread.set(true);
}
MOZ_ASSERT(NS_IsMainThread());
}
示例3:
void
InitScriptSettings()
{
if (!sScriptSettingsTLS.initialized()) {
bool success = sScriptSettingsTLS.init();
if (!success) {
MOZ_CRASH();
}
}
sScriptSettingsTLS.set(nullptr);
}
示例4: EnsureGLContext
void EnsureGLContext(const GrGLInterface* i)
{
const DrawTarget* drawTarget = reinterpret_cast<const DrawTarget*>(i->fCallbackData);
GLContext* gl = static_cast<GLContext*>(drawTarget->GetGLContext());
gl->MakeCurrent();
if (!sGLContext.initialized()) {
mozilla::DebugOnly<bool> success = sGLContext.init();
MOZ_ASSERT(success);
}
sGLContext.set(gl);
}
示例5: EnsureGLContext
void EnsureGLContext(const GrGLInterface* i)
{
const SkiaGLGlue* contextSkia = reinterpret_cast<const SkiaGLGlue*>(i->fCallbackData);
GLContext* gl = contextSkia->GetGLContext();
gl->MakeCurrent();
if (!sGLContext.initialized()) {
mozilla::DebugOnly<bool> success = sGLContext.init();
MOZ_ASSERT(success);
}
sGLContext.set(gl);
}
示例6: ScriptSettingsStack
void
InitScriptSettings()
{
if (!sScriptSettingsTLS.initialized()) {
bool success = sScriptSettingsTLS.init();
if (!success) {
MOZ_CRASH();
}
}
ScriptSettingsStack* ptr = new ScriptSettingsStack();
sScriptSettingsTLS.set(ptr);
}
示例7: ObsoleteCurrentTraceInfos
void
InitTaskTracer(uint32_t aFlags)
{
if (aFlags & FORKED_AFTER_NUWA) {
ObsoleteCurrentTraceInfos();
return;
}
MOZ_ASSERT(!sTraceInfos);
sTraceInfos = new nsTArray<nsAutoPtr<TraceInfo>>();
if (!sTraceInfoTLS.initialized()) {
Unused << sTraceInfoTLS.init();
}
}
示例8: FreeTraceInfo
TraceInfo*
GetOrCreateTraceInfo()
{
ENSURE_TRUE(sTraceInfoTLS.initialized(), nullptr);
ENSURE_TRUE(IsStartLogging(), nullptr);
TraceInfo* info = sTraceInfoTLS.get();
if (info && info->mObsolete) {
// TraceInfo is obsolete: remove it.
FreeTraceInfo(info);
info = nullptr;
}
if (!info) {
info = AllocTraceInfo(gettid());
sTraceInfoTLS.set(info);
}
return info;
}