mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 758034 - Create separate inter-slice GC timer (r=smaug)
This commit is contained in:
parent
4e579eefba
commit
cafe4d1a74
@ -131,6 +131,7 @@ static nsITimer *sGCTimer;
|
||||
static nsITimer *sShrinkGCBuffersTimer;
|
||||
static nsITimer *sCCTimer;
|
||||
static nsITimer *sFullGCTimer;
|
||||
static nsITimer *sInterSliceGCTimer;
|
||||
|
||||
static PRTime sLastCCEndTime;
|
||||
|
||||
@ -3096,7 +3097,11 @@ nsJSContext::CycleCollectNow(nsICycleCollectorListener *aListener,
|
||||
void
|
||||
GCTimerFired(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
NS_RELEASE(sGCTimer);
|
||||
if (aTimer == sGCTimer) {
|
||||
NS_RELEASE(sGCTimer);
|
||||
} else {
|
||||
NS_RELEASE(sInterSliceGCTimer);
|
||||
}
|
||||
|
||||
uintptr_t reason = reinterpret_cast<uintptr_t>(aClosure);
|
||||
nsJSContext::GarbageCollectNow(static_cast<js::gcreason::Reason>(reason),
|
||||
@ -3318,6 +3323,15 @@ nsJSContext::KillFullGCTimer()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsJSContext::KillInterSliceGCTimer()
|
||||
{
|
||||
if (sInterSliceGCTimer) {
|
||||
sInterSliceGCTimer->Cancel();
|
||||
NS_RELEASE(sInterSliceGCTimer);
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void
|
||||
nsJSContext::KillShrinkGCBuffersTimer()
|
||||
@ -3417,13 +3431,18 @@ DOMGCSliceCallback(JSRuntime *aRt, js::GCProgress aProgress, const js::GCDescrip
|
||||
|
||||
// The GC has more work to do, so schedule another GC slice.
|
||||
if (aProgress == js::GC_SLICE_END) {
|
||||
nsJSContext::KillGCTimer();
|
||||
nsJSContext::PokeGC(js::gcreason::INTER_SLICE_GC, NS_INTERSLICE_GC_DELAY);
|
||||
nsJSContext::KillInterSliceGCTimer();
|
||||
CallCreateInstance("@mozilla.org/timer;1", &sInterSliceGCTimer);
|
||||
js::gcreason::Reason reason = js::gcreason::INTER_SLICE_GC;
|
||||
sInterSliceGCTimer->InitWithFuncCallback(GCTimerFired,
|
||||
reinterpret_cast<void *>(reason),
|
||||
NS_INTERSLICE_GC_DELAY,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
if (aProgress == js::GC_CYCLE_END) {
|
||||
// May need to kill the inter-slice GC timer
|
||||
nsJSContext::KillGCTimer();
|
||||
nsJSContext::KillInterSliceGCTimer();
|
||||
|
||||
sCCollectedWaitingForGC = 0;
|
||||
sCleanupsSinceLastGC = 0;
|
||||
@ -3844,6 +3863,7 @@ nsJSRuntime::Shutdown()
|
||||
nsJSContext::KillShrinkGCBuffersTimer();
|
||||
nsJSContext::KillCCTimer();
|
||||
nsJSContext::KillFullGCTimer();
|
||||
nsJSContext::KillInterSliceGCTimer();
|
||||
|
||||
NS_IF_RELEASE(gNameSpaceManager);
|
||||
|
||||
|
@ -163,6 +163,7 @@ public:
|
||||
static void MaybePokeCC();
|
||||
static void KillCCTimer();
|
||||
static void KillFullGCTimer();
|
||||
static void KillInterSliceGCTimer();
|
||||
|
||||
virtual void GC(js::gcreason::Reason aReason);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user