зеркало из https://github.com/mozilla/gecko-dev.git
bug 1455210 call CycleCollectedJSContext::Get() only once in EnterDebuggerEventLoop() r=baku
The WorkerJSContext is created and destroyed after entry and before exit from WorkerThreadPrimaryRunnable::Run(). WorkerPrivate::EnterDebuggerEventLoop() is called only while WorkerThreadPrimaryRunnable::Run is on the stack, and so the CycleCollectedJSContext will not change. MozReview-Commit-ID: HMJ8fpKC6E3 --HG-- extra : rebase_source : d481f4513f9e5ed29224ce01534fa3de95bc7ae4
This commit is contained in:
Родитель
8768dc6854
Коммит
c4ee57e5e6
|
@ -4402,6 +4402,7 @@ WorkerPrivate::EnterDebuggerEventLoop()
|
|||
|
||||
JSContext* cx = GetJSContext();
|
||||
MOZ_ASSERT(cx);
|
||||
CycleCollectedJSContext* ccjscx = CycleCollectedJSContext::Get();
|
||||
|
||||
uint32_t currentEventLoopLevel = ++mDebuggerEventLoopLevel;
|
||||
|
||||
|
@ -4424,9 +4425,8 @@ WorkerPrivate::EnterDebuggerEventLoop()
|
|||
{
|
||||
MutexAutoLock lock(mMutex);
|
||||
|
||||
CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
|
||||
std::queue<RefPtr<MicroTaskRunnable>>& debuggerMtQueue =
|
||||
context->GetDebuggerMicroTaskQueue();
|
||||
ccjscx->GetDebuggerMicroTaskQueue();
|
||||
while (mControlQueue.IsEmpty() &&
|
||||
!(debuggerRunnablesPending = !mDebuggerQueue.IsEmpty()) &&
|
||||
debuggerMtQueue.empty()) {
|
||||
|
@ -4437,8 +4437,7 @@ WorkerPrivate::EnterDebuggerEventLoop()
|
|||
|
||||
// XXXkhuey should we abort JS on the stack here if we got Abort above?
|
||||
}
|
||||
CycleCollectedJSContext* context = CycleCollectedJSContext::Get();
|
||||
context->PerformDebuggerMicroTaskCheckpoint();
|
||||
ccjscx->PerformDebuggerMicroTaskCheckpoint();
|
||||
if (debuggerRunnablesPending) {
|
||||
// Start the periodic GC timer if it is not already running.
|
||||
SetGCTimerMode(PeriodicTimer);
|
||||
|
@ -4455,8 +4454,7 @@ WorkerPrivate::EnterDebuggerEventLoop()
|
|||
static_cast<nsIRunnable*>(runnable)->Run();
|
||||
runnable->Release();
|
||||
|
||||
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||
ccjs->PerformDebuggerMicroTaskCheckpoint();
|
||||
ccjscx->PerformDebuggerMicroTaskCheckpoint();
|
||||
|
||||
// Now *might* be a good time to GC. Let the JS engine make the decision.
|
||||
if (JS::CurrentGlobalOrNull(cx)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче