mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Bug 1405821 - Move microtask handling to CycleCollectedJSContext
Tag UXP Issue #1344
This commit is contained in:
parent
5776911c05
commit
fb6f6ec903
11 changed files with 100 additions and 84 deletions
|
|
@ -79,6 +79,7 @@
|
|||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsCycleCollector.h"
|
||||
#include "nsDOMJSUtils.h"
|
||||
#include "nsDOMMutationObserver.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
|
|
@ -438,6 +439,7 @@ CycleCollectedJSContext::CycleCollectedJSContext()
|
|||
, mJSHolders(256)
|
||||
, mDoingStableStates(false)
|
||||
, mDisableMicroTaskCheckpoint(false)
|
||||
, mMicroTaskLevel(0)
|
||||
, mOutOfMemoryState(OOMState::OK)
|
||||
, mLargeAllocationFailureState(OOMState::OK)
|
||||
{
|
||||
|
|
@ -1379,7 +1381,7 @@ CycleCollectedJSContext::AfterProcessTask(uint32_t aRecursionDepth)
|
|||
// Step 4.1: Execute microtasks.
|
||||
if (!mDisableMicroTaskCheckpoint) {
|
||||
if (NS_IsMainThread()) {
|
||||
nsContentUtils::PerformMainThreadMicroTaskCheckpoint();
|
||||
PerformMainThreadMicroTaskCheckpoint();
|
||||
Promise::PerformMicroTaskCheckpoint();
|
||||
} else {
|
||||
Promise::PerformWorkerMicroTaskCheckpoint();
|
||||
|
|
@ -1659,6 +1661,14 @@ CycleCollectedJSContext::DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunn
|
|||
mPromiseMicroTaskQueue.push(runnable.forget());
|
||||
}
|
||||
|
||||
void
|
||||
CycleCollectedJSContext::PerformMainThreadMicroTaskCheckpoint()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
nsDOMMutationObserver::HandleMutations();
|
||||
}
|
||||
|
||||
void
|
||||
CycleCollectedJSContext::EnvironmentPreparer::invoke(JS::HandleObject scope,
|
||||
js::ScriptEnvironmentPreparer::Closure& closure)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue