diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2020-01-22 19:28:33 -0500 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2020-01-26 15:50:49 -0500 |
commit | 43a8113072b96affb2b7a3a7a4e965547d3d0c41 (patch) | |
tree | dd685edd37f2bffec27c55060e50ba8289e05760 /xpcom/base/CycleCollectedJSContext.cpp | |
parent | 14d115cfe32ab72b7193a4fb74e13c06c6d4cc8f (diff) | |
download | UXP-43a8113072b96affb2b7a3a7a4e965547d3d0c41.tar UXP-43a8113072b96affb2b7a3a7a4e965547d3d0c41.tar.gz UXP-43a8113072b96affb2b7a3a7a4e965547d3d0c41.tar.lz UXP-43a8113072b96affb2b7a3a7a4e965547d3d0c41.tar.xz UXP-43a8113072b96affb2b7a3a7a4e965547d3d0c41.zip |
Bug 1405821 - Move microtask handling to CycleCollectedJSContext
Tag UXP Issue #1344
Diffstat (limited to 'xpcom/base/CycleCollectedJSContext.cpp')
-rw-r--r-- | xpcom/base/CycleCollectedJSContext.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp index e16c15455..0a85ae6ac 100644 --- a/xpcom/base/CycleCollectedJSContext.cpp +++ b/xpcom/base/CycleCollectedJSContext.cpp @@ -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(); @@ -1660,6 +1662,14 @@ CycleCollectedJSContext::DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunn } void +CycleCollectedJSContext::PerformMainThreadMicroTaskCheckpoint() +{ + MOZ_ASSERT(NS_IsMainThread()); + + nsDOMMutationObserver::HandleMutations(); +} + +void CycleCollectedJSContext::EnvironmentPreparer::invoke(JS::HandleObject scope, js::ScriptEnvironmentPreparer::Closure& closure) { |