зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
96500c4e69
Коммит
884fc2ea5c
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче