mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-15 19:57:29 +09:00
Bug 1406922 - Make CycleCollectedJSContext to handle microtasks and make MutationObserver to use them
Tag UXP Issue #1344
This commit is contained in:
parent
fb6f6ec903
commit
249667092c
5 changed files with 164 additions and 48 deletions
|
|
@ -33,6 +33,7 @@ struct Class;
|
|||
} // namespace js
|
||||
|
||||
namespace mozilla {
|
||||
class AutoSlowOperation;
|
||||
|
||||
class JSGCThingParticipant: public nsCycleCollectionParticipant
|
||||
{
|
||||
|
|
@ -134,6 +135,17 @@ struct CycleCollectorResults
|
|||
uint32_t mNumSlices;
|
||||
};
|
||||
|
||||
class MicroTaskRunnable
|
||||
{
|
||||
public:
|
||||
MicroTaskRunnable() {}
|
||||
NS_INLINE_DECL_REFCOUNTING(MicroTaskRunnable)
|
||||
virtual void Run(AutoSlowOperation& aAso) = 0;
|
||||
virtual bool Suppressed() { return false; }
|
||||
protected:
|
||||
virtual ~MicroTaskRunnable() {}
|
||||
};
|
||||
|
||||
class CycleCollectedJSContext
|
||||
{
|
||||
friend class JSGCThingParticipant;
|
||||
|
|
@ -412,7 +424,7 @@ public:
|
|||
void LeaveMicroTask()
|
||||
{
|
||||
if (--mMicroTaskLevel == 0) {
|
||||
PerformMainThreadMicroTaskCheckpoint();
|
||||
PerformMicroTaskCheckPoint();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -431,7 +443,9 @@ public:
|
|||
mMicroTaskLevel = aLevel;
|
||||
}
|
||||
|
||||
void PerformMainThreadMicroTaskCheckpoint();
|
||||
void PerformMicroTaskCheckPoint();
|
||||
|
||||
void DispatchMicroTaskRunnable(already_AddRefed<MicroTaskRunnable> aRunnable);
|
||||
|
||||
// Storage for watching rejected promises waiting for some client to
|
||||
// consume their rejection.
|
||||
|
|
@ -484,6 +498,10 @@ private:
|
|||
bool mDisableMicroTaskCheckpoint;
|
||||
|
||||
uint32_t mMicroTaskLevel;
|
||||
std::queue<RefPtr<MicroTaskRunnable>> mPendingMicroTaskRunnables;
|
||||
|
||||
uint32_t mMicroTaskRecursionDepth;
|
||||
|
||||
OOMState mOutOfMemoryState;
|
||||
OOMState mLargeAllocationFailureState;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue