diff options
Diffstat (limited to 'xpcom/base/CycleCollectedJSContext.h')
-rw-r--r-- | xpcom/base/CycleCollectedJSContext.h | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/xpcom/base/CycleCollectedJSContext.h b/xpcom/base/CycleCollectedJSContext.h index 2197eae92..4cd1479ed 100644 --- a/xpcom/base/CycleCollectedJSContext.h +++ b/xpcom/base/CycleCollectedJSContext.h @@ -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; |