Revert "Some fixes."

This reverts commit 9a5010a8e35000418a29726f23973d28e92e27a6.
This commit is contained in:
win7-7 2026-01-28 18:02:20 +02:00 committed by wuggy
commit 7392b9b504
2 changed files with 56 additions and 9 deletions

View file

@ -2222,9 +2222,12 @@ nsJSContext::MaybePokeCC()
void
nsJSContext::KillGCTimer()
{
if (sGCTimer) {
sGCTimer->Cancel();
NS_RELEASE(sGCTimer);
sScheduler->CancelScheduledTask(sMainThreadCollectorScheduling,
CollectorSchedule::eInitialGC);
sScheduler->CancelScheduledTask(sMainThreadCollectorScheduling,
CollectorSchedule::eGC);
sScheduler->CancelScheduledTask(sMainThreadCollectorScheduling,
CollectorSchedule::eVariableScheduledGC);
}
}
@ -2441,7 +2444,7 @@ nsJSContext::LikelyShortLivingObjectCreated()
void
mozilla::dom::StartupJSEnvironment()
{
sScheduler = CycleCollectedJSContext::GetScheduler();
sScheduler = CycleCollectedJSRuntime::GetScheduler();
MOZ_ASSERT(sScheduler);
MOZ_ASSERT(sMainThreadCollectorScheduling[CollectorSchedule::eGC].mDelayMillis ==
NS_GC_DELAY);
@ -2771,9 +2774,9 @@ nsJSContext::EnsureStatics()
"javascript.options.compact_on_user_inactive",
true);
Preferences::AddUintVarCache(&sCompactOnUserInactiveDelay,
"javascript.options.compact_on_user_inactive_delay",
NS_DEAULT_INACTIVE_GC_DELAY);
sMainThreadCollectorScheduling[CollectorSchedule::eShrinkGCBuffers].mDelayMillis =
Preferences::GetUint("javascript.options.compact_on_user_inactive_delay",
NS_DEFAULT_INACTIVE_GC_DELAY);
Preferences::AddBoolVarCache(&sPostGCEventsToConsole,
JS_OPTIONS_DOT_STR "mem.log");
@ -2790,6 +2793,50 @@ nsJSContext::EnsureStatics()
sIsInitialized = true;
}
void
nsJSContext::NotifyDidPaint()
{
sDidPaintAfterPreviousICCSlice = true;
if (sICCTimer) {
static uint32_t sCount = 0;
// 16 here is the common value for refresh driver tick frequency.
static const uint32_t kTicksPerSliceDelay = kICCIntersliceDelay / 16;
if (++sCount % kTicksPerSliceDelay != 0) {
// Don't trigger CC slice all the time after paint, but often still.
// The key point is to trigger it right after paint, especially when
// we're running RefreshDriver constantly.
return;
}
sICCTimer->Cancel();
ICCTimerFired(nullptr, nullptr);
if (sICCTimer) {
sICCTimer->InitWithNamedFuncCallback(ICCTimerFired, nullptr,
kICCIntersliceDelay,
nsITimer::TYPE_REPEATING_SLACK,
"ICCTimerFired");
}
} else if (sCCTimer) {
static uint32_t sCount = 0;
static const uint32_t kTicksPerForgetSkippableDelay =
NS_CC_SKIPPABLE_DELAY / 16;
if (++sCount % kTicksPerForgetSkippableDelay != 0) {
// The comment above about triggering CC slice applies to forget skippable
// too.
return;
}
sCCTimer->Cancel();
CCTimerFired(nullptr, nullptr);
if (sCCTimer) {
sCCTimer->InitWithNamedFuncCallback(CCTimerFired, nullptr,
NS_CC_SKIPPABLE_DELAY,
nsITimer::TYPE_REPEATING_SLACK,
"CCTimerFired");
}
}
}
nsScriptNameSpaceManager*
mozilla::dom::GetNameSpaceManager()
{

View file

@ -1107,9 +1107,9 @@ public:
uint32_t aDelay) override
{
NS_ENSURE_STATE(mWorkerPrivate);
RefPtr<ExternalRunnableWrapper> wrapper =
nsRefPtr<ExternalRunnableWrapper> wrapper =
new ExternalRunnableWrapper(mWorkerPrivate, aRunnable);
RefPtr<TimerThreadEventTarget> target =
nsRefPtr<TimerThreadEventTarget> target =
new TimerThreadEventTarget(mWorkerPrivate, wrapper);
aTimer->SetTarget(target);
return aTimer->InitWithFuncCallback(DummyCallback, nullptr, aDelay,