mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-22 23:27:30 +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
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "mozilla/dom/CustomElementRegistry.h"
|
#include "mozilla/dom/CustomElementRegistry.h"
|
||||||
|
|
||||||
|
#include "mozilla/CycleCollectedJSContext.h"
|
||||||
#include "mozilla/dom/CustomElementRegistryBinding.h"
|
#include "mozilla/dom/CustomElementRegistryBinding.h"
|
||||||
#include "mozilla/dom/HTMLElementBinding.h"
|
#include "mozilla/dom/HTMLElementBinding.h"
|
||||||
#include "mozilla/dom/WebComponentsBinding.h"
|
#include "mozilla/dom/WebComponentsBinding.h"
|
||||||
|
|
|
||||||
|
|
@ -259,7 +259,6 @@ nsIWordBreaker *nsContentUtils::sWordBreaker;
|
||||||
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nullptr;
|
nsIBidiKeyboard *nsContentUtils::sBidiKeyboard = nullptr;
|
||||||
uint32_t nsContentUtils::sScriptBlockerCount = 0;
|
uint32_t nsContentUtils::sScriptBlockerCount = 0;
|
||||||
uint32_t nsContentUtils::sDOMNodeRemovedSuppressCount = 0;
|
uint32_t nsContentUtils::sDOMNodeRemovedSuppressCount = 0;
|
||||||
uint32_t nsContentUtils::sMicroTaskLevel = 0;
|
|
||||||
AutoTArray<nsCOMPtr<nsIRunnable>, 8>* nsContentUtils::sBlockedScriptRunners = nullptr;
|
AutoTArray<nsCOMPtr<nsIRunnable>, 8>* nsContentUtils::sBlockedScriptRunners = nullptr;
|
||||||
uint32_t nsContentUtils::sRunnersCountAtFirstBlocker = 0;
|
uint32_t nsContentUtils::sRunnersCountAtFirstBlocker = 0;
|
||||||
nsIInterfaceRequestor* nsContentUtils::sSameOriginChecker = nullptr;
|
nsIInterfaceRequestor* nsContentUtils::sSameOriginChecker = nullptr;
|
||||||
|
|
@ -5302,51 +5301,6 @@ nsContentUtils::RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable)
|
||||||
CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable));
|
CycleCollectedJSContext::Get()->RunInMetastableState(Move(aRunnable));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
nsContentUtils::EnterMicroTask()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
++sMicroTaskLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsContentUtils::LeaveMicroTask()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
if (--sMicroTaskLevel == 0) {
|
|
||||||
PerformMainThreadMicroTaskCheckpoint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
nsContentUtils::IsInMicroTask()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
return sMicroTaskLevel != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t
|
|
||||||
nsContentUtils::MicroTaskLevel()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
return sMicroTaskLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsContentUtils::SetMicroTaskLevel(uint32_t aLevel)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
sMicroTaskLevel = aLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
nsContentUtils::PerformMainThreadMicroTaskCheckpoint()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
|
|
||||||
nsDOMMutationObserver::HandleMutations();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Helper function for nsContentUtils::ProcessViewportInfo.
|
* Helper function for nsContentUtils::ProcessViewportInfo.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1740,17 +1740,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
|
static void RunInMetastableState(already_AddRefed<nsIRunnable> aRunnable);
|
||||||
|
|
||||||
// Call EnterMicroTask when you're entering JS execution.
|
|
||||||
// Usually the best way to do this is to use nsAutoMicroTask.
|
|
||||||
static void EnterMicroTask();
|
|
||||||
static void LeaveMicroTask();
|
|
||||||
|
|
||||||
static bool IsInMicroTask();
|
|
||||||
static uint32_t MicroTaskLevel();
|
|
||||||
static void SetMicroTaskLevel(uint32_t aLevel);
|
|
||||||
|
|
||||||
static void PerformMainThreadMicroTaskCheckpoint();
|
|
||||||
|
|
||||||
/* Process viewport META data. This gives us information for the scale
|
/* Process viewport META data. This gives us information for the scale
|
||||||
* and zoom of a page on mobile devices. We stick the information in
|
* and zoom of a page on mobile devices. We stick the information in
|
||||||
* the document header and use it later on after rendering.
|
* the document header and use it later on after rendering.
|
||||||
|
|
@ -2850,7 +2839,6 @@ private:
|
||||||
static bool sInitialized;
|
static bool sInitialized;
|
||||||
static uint32_t sScriptBlockerCount;
|
static uint32_t sScriptBlockerCount;
|
||||||
static uint32_t sDOMNodeRemovedSuppressCount;
|
static uint32_t sDOMNodeRemovedSuppressCount;
|
||||||
static uint32_t sMicroTaskLevel;
|
|
||||||
// Not an nsCOMArray because removing elements from those is slower
|
// Not an nsCOMArray because removing elements from those is slower
|
||||||
static AutoTArray<nsCOMPtr<nsIRunnable>, 8>* sBlockedScriptRunners;
|
static AutoTArray<nsCOMPtr<nsIRunnable>, 8>* sBlockedScriptRunners;
|
||||||
static uint32_t sRunnersCountAtFirstBlocker;
|
static uint32_t sRunnersCountAtFirstBlocker;
|
||||||
|
|
@ -2928,19 +2916,6 @@ public:
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class MOZ_STACK_CLASS nsAutoMicroTask
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsAutoMicroTask()
|
|
||||||
{
|
|
||||||
nsContentUtils::EnterMicroTask();
|
|
||||||
}
|
|
||||||
~nsAutoMicroTask()
|
|
||||||
{
|
|
||||||
nsContentUtils::LeaveMicroTask();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace dom {
|
namespace dom {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12610,8 +12610,12 @@ MarkDocumentTreeToBeInSyncOperation(nsIDocument* aDoc, void* aData)
|
||||||
|
|
||||||
nsAutoSyncOperation::nsAutoSyncOperation(nsIDocument* aDoc)
|
nsAutoSyncOperation::nsAutoSyncOperation(nsIDocument* aDoc)
|
||||||
{
|
{
|
||||||
mMicroTaskLevel = nsContentUtils::MicroTaskLevel();
|
mMicroTaskLevel = 0;
|
||||||
nsContentUtils::SetMicroTaskLevel(0);
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
mMicroTaskLevel = ccjs->MicroTaskLevel();
|
||||||
|
ccjs->SetMicroTaskLevel(0);
|
||||||
|
}
|
||||||
if (aDoc) {
|
if (aDoc) {
|
||||||
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
|
if (nsPIDOMWindowOuter* win = aDoc->GetWindow()) {
|
||||||
if (nsCOMPtr<nsPIDOMWindowOuter> top = win->GetTop()) {
|
if (nsCOMPtr<nsPIDOMWindowOuter> top = win->GetTop()) {
|
||||||
|
|
@ -12627,7 +12631,10 @@ nsAutoSyncOperation::~nsAutoSyncOperation()
|
||||||
for (int32_t i = 0; i < mDocuments.Count(); ++i) {
|
for (int32_t i = 0; i < mDocuments.Count(); ++i) {
|
||||||
mDocuments[i]->SetIsInSyncOperation(false);
|
mDocuments[i]->SetIsInSyncOperation(false);
|
||||||
}
|
}
|
||||||
nsContentUtils::SetMicroTaskLevel(mMicroTaskLevel);
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
ccjs->SetMicroTaskLevel(mMicroTaskLevel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gfxUserFontSet*
|
gfxUserFontSet*
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
#include "xpcpublic.h"
|
#include "xpcpublic.h"
|
||||||
#include "nsContentUtils.h"
|
#include "nsContentUtils.h"
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
|
#include "mozilla/CycleCollectedJSContext.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "mozilla/dom/Date.h"
|
#include "mozilla/dom/Date.h"
|
||||||
#include "mozilla/dom/Element.h"
|
#include "mozilla/dom/Element.h"
|
||||||
|
|
@ -159,7 +159,8 @@ nsJSUtils::EvaluateString(JSContext* aCx,
|
||||||
aEvaluationGlobal);
|
aEvaluationGlobal);
|
||||||
MOZ_ASSERT_IF(aOffThreadToken, aCompileOptions.noScriptRval);
|
MOZ_ASSERT_IF(aOffThreadToken, aCompileOptions.noScriptRval);
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
|
||||||
|
CycleCollectedJSContext::Get()->MicroTaskLevel());
|
||||||
|
|
||||||
// Unfortunately, the JS engine actually compiles scripts with a return value
|
// Unfortunately, the JS engine actually compiles scripts with a return value
|
||||||
// in a different, less efficient way. Furthermore, it can't JIT them in many
|
// in a different, less efficient way. Furthermore, it can't JIT them in many
|
||||||
|
|
@ -293,7 +294,8 @@ nsJSUtils::CompileModule(JSContext* aCx,
|
||||||
aEvaluationGlobal);
|
aEvaluationGlobal);
|
||||||
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx) == aEvaluationGlobal);
|
MOZ_ASSERT(JS::CurrentGlobalOrNull(aCx) == aEvaluationGlobal);
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
|
||||||
|
CycleCollectedJSContext::Get()->MicroTaskLevel());
|
||||||
|
|
||||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
|
NS_ENSURE_TRUE(xpc::Scriptability::Get(aEvaluationGlobal).Allowed(), NS_OK);
|
||||||
|
|
||||||
|
|
@ -330,7 +332,8 @@ nsJSUtils::ModuleEvaluation(JSContext* aCx, JS::Handle<JSObject*> aModule)
|
||||||
|
|
||||||
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
|
MOZ_ASSERT(aCx == nsContentUtils::GetCurrentJSContext());
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(nsContentUtils::IsInMicroTask());
|
MOZ_ASSERT(CycleCollectedJSContext::Get() &&
|
||||||
|
CycleCollectedJSContext::Get()->MicroTaskLevel());
|
||||||
|
|
||||||
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
|
NS_ENSURE_TRUE(xpc::Scriptability::Get(aModule).Allowed(), NS_OK);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
#include "mozilla/dom/CallbackObject.h"
|
#include "mozilla/dom/CallbackObject.h"
|
||||||
|
#include "mozilla/CycleCollectedJSContext.h"
|
||||||
#include "mozilla/dom/BindingUtils.h"
|
#include "mozilla/dom/BindingUtils.h"
|
||||||
#include "jsfriendapi.h"
|
#include "jsfriendapi.h"
|
||||||
#include "nsIScriptGlobalObject.h"
|
#include "nsIScriptGlobalObject.h"
|
||||||
|
|
@ -79,7 +80,10 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
||||||
, mIsMainThread(NS_IsMainThread())
|
, mIsMainThread(NS_IsMainThread())
|
||||||
{
|
{
|
||||||
if (mIsMainThread) {
|
if (mIsMainThread) {
|
||||||
nsContentUtils::EnterMicroTask();
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
ccjs->EnterMicroTask();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the caller's subject principal (if necessary) early, before we
|
// Compute the caller's subject principal (if necessary) early, before we
|
||||||
|
|
@ -288,7 +292,10 @@ CallbackObject::CallSetup::~CallSetup()
|
||||||
// It is important that this is the last thing we do, after leaving the
|
// It is important that this is the last thing we do, after leaving the
|
||||||
// compartment and undoing all our entry/incumbent script changes
|
// compartment and undoing all our entry/incumbent script changes
|
||||||
if (mIsMainThread) {
|
if (mIsMainThread) {
|
||||||
nsContentUtils::LeaveMicroTask();
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
ccjs->LeaveMicroTask();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1087,7 +1087,10 @@ EventListenerManager::HandleEventSubType(Listener* aListener,
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
if (mIsMainThreadELM) {
|
if (mIsMainThreadELM) {
|
||||||
nsContentUtils::EnterMicroTask();
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
ccjs->EnterMicroTask();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// nsIDOMEvent::currentTarget is set in EventDispatcher.
|
// nsIDOMEvent::currentTarget is set in EventDispatcher.
|
||||||
if (listenerHolder.HasWebIDLCallback()) {
|
if (listenerHolder.HasWebIDLCallback()) {
|
||||||
|
|
@ -1099,7 +1102,10 @@ EventListenerManager::HandleEventSubType(Listener* aListener,
|
||||||
result = listenerHolder.GetXPCOMCallback()->HandleEvent(aDOMEvent);
|
result = listenerHolder.GetXPCOMCallback()->HandleEvent(aDOMEvent);
|
||||||
}
|
}
|
||||||
if (mIsMainThreadELM) {
|
if (mIsMainThreadELM) {
|
||||||
nsContentUtils::LeaveMicroTask();
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
ccjs->LeaveMicroTask();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
#include "nsIWritablePropertyBag2.h"
|
#include "nsIWritablePropertyBag2.h"
|
||||||
#include "nsIContentSecurityPolicy.h"
|
#include "nsIContentSecurityPolicy.h"
|
||||||
#include "nsSandboxFlags.h"
|
#include "nsSandboxFlags.h"
|
||||||
|
#include "mozilla/CycleCollectedJSContext.h"
|
||||||
#include "mozilla/dom/ScriptSettings.h"
|
#include "mozilla/dom/ScriptSettings.h"
|
||||||
#include "nsILoadInfo.h"
|
#include "nsILoadInfo.h"
|
||||||
#include "nsContentSecurityManager.h"
|
#include "nsContentSecurityManager.h"
|
||||||
|
|
@ -241,7 +242,7 @@ nsresult nsJSThunk::EvaluateScript(nsIChannel *aChannel,
|
||||||
|
|
||||||
// New script entry point required, due to the "Create a script" step of
|
// New script entry point required, due to the "Create a script" step of
|
||||||
// http://www.whatwg.org/specs/web-apps/current-work/#javascript-protocol
|
// http://www.whatwg.org/specs/web-apps/current-work/#javascript-protocol
|
||||||
nsAutoMicroTask mt;
|
mozilla::nsAutoMicroTask mt;
|
||||||
AutoEntryScript aes(innerGlobal, "javascript: URI", true);
|
AutoEntryScript aes(innerGlobal, "javascript: URI", true);
|
||||||
JSContext* cx = aes.cx();
|
JSContext* cx = aes.cx();
|
||||||
JS::Rooted<JSObject*> globalJSObject(cx, innerGlobal->GetGlobalJSObject());
|
JS::Rooted<JSObject*> globalJSObject(cx, innerGlobal->GetGlobalJSObject());
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,7 @@
|
||||||
#include "nsCycleCollectionParticipant.h"
|
#include "nsCycleCollectionParticipant.h"
|
||||||
#include "nsCycleCollector.h"
|
#include "nsCycleCollector.h"
|
||||||
#include "nsDOMJSUtils.h"
|
#include "nsDOMJSUtils.h"
|
||||||
|
#include "nsDOMMutationObserver.h"
|
||||||
#include "nsJSUtils.h"
|
#include "nsJSUtils.h"
|
||||||
#include "nsWrapperCache.h"
|
#include "nsWrapperCache.h"
|
||||||
|
|
||||||
|
|
@ -438,6 +439,7 @@ CycleCollectedJSContext::CycleCollectedJSContext()
|
||||||
, mJSHolders(256)
|
, mJSHolders(256)
|
||||||
, mDoingStableStates(false)
|
, mDoingStableStates(false)
|
||||||
, mDisableMicroTaskCheckpoint(false)
|
, mDisableMicroTaskCheckpoint(false)
|
||||||
|
, mMicroTaskLevel(0)
|
||||||
, mOutOfMemoryState(OOMState::OK)
|
, mOutOfMemoryState(OOMState::OK)
|
||||||
, mLargeAllocationFailureState(OOMState::OK)
|
, mLargeAllocationFailureState(OOMState::OK)
|
||||||
{
|
{
|
||||||
|
|
@ -1379,7 +1381,7 @@ CycleCollectedJSContext::AfterProcessTask(uint32_t aRecursionDepth)
|
||||||
// Step 4.1: Execute microtasks.
|
// Step 4.1: Execute microtasks.
|
||||||
if (!mDisableMicroTaskCheckpoint) {
|
if (!mDisableMicroTaskCheckpoint) {
|
||||||
if (NS_IsMainThread()) {
|
if (NS_IsMainThread()) {
|
||||||
nsContentUtils::PerformMainThreadMicroTaskCheckpoint();
|
PerformMainThreadMicroTaskCheckpoint();
|
||||||
Promise::PerformMicroTaskCheckpoint();
|
Promise::PerformMicroTaskCheckpoint();
|
||||||
} else {
|
} else {
|
||||||
Promise::PerformWorkerMicroTaskCheckpoint();
|
Promise::PerformWorkerMicroTaskCheckpoint();
|
||||||
|
|
@ -1659,6 +1661,14 @@ CycleCollectedJSContext::DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunn
|
||||||
mPromiseMicroTaskQueue.push(runnable.forget());
|
mPromiseMicroTaskQueue.push(runnable.forget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
CycleCollectedJSContext::PerformMainThreadMicroTaskCheckpoint()
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
nsDOMMutationObserver::HandleMutations();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CycleCollectedJSContext::EnvironmentPreparer::invoke(JS::HandleObject scope,
|
CycleCollectedJSContext::EnvironmentPreparer::invoke(JS::HandleObject scope,
|
||||||
js::ScriptEnvironmentPreparer::Closure& closure)
|
js::ScriptEnvironmentPreparer::Closure& closure)
|
||||||
|
|
|
||||||
|
|
@ -402,6 +402,37 @@ public:
|
||||||
// Queue an async microtask to the current main or worker thread.
|
// Queue an async microtask to the current main or worker thread.
|
||||||
virtual void DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunnable);
|
virtual void DispatchToMicroTask(already_AddRefed<nsIRunnable> aRunnable);
|
||||||
|
|
||||||
|
// Call EnterMicroTask when you're entering JS execution.
|
||||||
|
// Usually the best way to do this is to use nsAutoMicroTask.
|
||||||
|
void EnterMicroTask()
|
||||||
|
{
|
||||||
|
++mMicroTaskLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LeaveMicroTask()
|
||||||
|
{
|
||||||
|
if (--mMicroTaskLevel == 0) {
|
||||||
|
PerformMainThreadMicroTaskCheckpoint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsInMicroTask()
|
||||||
|
{
|
||||||
|
return mMicroTaskLevel != 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t MicroTaskLevel()
|
||||||
|
{
|
||||||
|
return mMicroTaskLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetMicroTaskLevel(uint32_t aLevel)
|
||||||
|
{
|
||||||
|
mMicroTaskLevel = aLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void PerformMainThreadMicroTaskCheckpoint();
|
||||||
|
|
||||||
// Storage for watching rejected promises waiting for some client to
|
// Storage for watching rejected promises waiting for some client to
|
||||||
// consume their rejection.
|
// consume their rejection.
|
||||||
|
|
||||||
|
|
@ -452,6 +483,7 @@ private:
|
||||||
|
|
||||||
bool mDisableMicroTaskCheckpoint;
|
bool mDisableMicroTaskCheckpoint;
|
||||||
|
|
||||||
|
uint32_t mMicroTaskLevel;
|
||||||
OOMState mOutOfMemoryState;
|
OOMState mOutOfMemoryState;
|
||||||
OOMState mLargeAllocationFailureState;
|
OOMState mLargeAllocationFailureState;
|
||||||
|
|
||||||
|
|
@ -470,6 +502,25 @@ private:
|
||||||
EnvironmentPreparer mEnvironmentPreparer;
|
EnvironmentPreparer mEnvironmentPreparer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class MOZ_STACK_CLASS nsAutoMicroTask
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
nsAutoMicroTask()
|
||||||
|
{
|
||||||
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
ccjs->EnterMicroTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~nsAutoMicroTask()
|
||||||
|
{
|
||||||
|
CycleCollectedJSContext* ccjs = CycleCollectedJSContext::Get();
|
||||||
|
if (ccjs) {
|
||||||
|
ccjs->LeaveMicroTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
void TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer);
|
void TraceScriptHolder(nsISupports* aHolder, JSTracer* aTracer);
|
||||||
|
|
||||||
// Returns true if the JS::TraceKind is one the cycle collector cares about.
|
// Returns true if the JS::TraceKind is one the cycle collector cares about.
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,7 @@ FINAL_LIBRARY = 'xul'
|
||||||
|
|
||||||
LOCAL_INCLUDES += [
|
LOCAL_INCLUDES += [
|
||||||
'../build',
|
'../build',
|
||||||
|
'/dom/base',
|
||||||
'/xpcom/ds',
|
'/xpcom/ds',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue