Bug 1316616 part 1. Replace some redundant code in GetCurrentThreadWorkerPrivate() with a call to a function that we already have. r=bkelly

This commit is contained in:
Boris Zbarsky 2016-11-18 16:13:06 -05:00
Родитель 96500c4e69
Коммит 884fc2ea5c
1 изменённых файлов: 5 добавлений и 11 удалений

Просмотреть файл

@ -1454,17 +1454,11 @@ GetCurrentThreadWorkerPrivate()
JSContext* cx = ccjscx->Context();
MOZ_ASSERT(cx);
void* cxPrivate = JS_GetContextPrivate(cx);
if (!cxPrivate) {
// This can happen if the nsCycleCollector_shutdown() in ~WorkerJSContext()
// triggers any calls to GetCurrentThreadWorkerPrivate(). At this stage
// CycleCollectedJSContext::Get() will still return a context, but
// the context private has already been cleared.
return nullptr;
}
return
static_cast<WorkerThreadContextPrivate*>(cxPrivate)->GetWorkerPrivate();
// Note that we can return nullptr if the nsCycleCollector_shutdown() in
// ~WorkerJSContext() triggers any calls to GetCurrentThreadWorkerPrivate().
// At this stage CycleCollectedJSContext::Get() will still return a context,
// but the context private has already been cleared.
return GetWorkerPrivateFromContext(cx);
}
bool