зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1726712
- Only do a shrinking GC if we're not animating r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D124014
This commit is contained in:
Родитель
b3f8450984
Коммит
a3770290ab
|
@ -7,6 +7,7 @@
|
|||
#include "mozilla/StaticPrefs_javascript.h"
|
||||
#include "mozilla/CycleCollectedJSRuntime.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "nsRefreshDriver.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -115,11 +116,20 @@ bool CCGCScheduler::GCRunnerFiredDoGC(TimeStamp aDeadline,
|
|||
// Run a GC slice, possibly the first one of a major GC.
|
||||
nsJSContext::IsShrinking is_shrinking = nsJSContext::NonShrinkingGC;
|
||||
if (!InIncrementalGC() && aStep.mReason == JS::GCReason::USER_INACTIVE) {
|
||||
bool do_gc = mWantAtLeastRegularGC;
|
||||
|
||||
if (!mUserIsActive) {
|
||||
mIsCompactingOnUserInactive = true;
|
||||
is_shrinking = nsJSContext::ShrinkingGC;
|
||||
} else if (!mWantAtLeastRegularGC) {
|
||||
// Don't GC now.
|
||||
if (!nsRefreshDriver::IsRegularRateTimerTicking()) {
|
||||
mIsCompactingOnUserInactive = true;
|
||||
is_shrinking = nsJSContext::ShrinkingGC;
|
||||
do_gc = true;
|
||||
} else {
|
||||
// Poke again to restart the timer.
|
||||
PokeShrinkingGC();
|
||||
}
|
||||
}
|
||||
|
||||
if (!do_gc) {
|
||||
using mozilla::ipc::IdleSchedulerChild;
|
||||
IdleSchedulerChild* child =
|
||||
IdleSchedulerChild::GetMainThreadIdleScheduler();
|
||||
|
@ -233,8 +243,14 @@ void CCGCScheduler::PokeShrinkingGC() {
|
|||
[](nsITimer* aTimer, void* aClosure) {
|
||||
CCGCScheduler* s = static_cast<CCGCScheduler*>(aClosure);
|
||||
s->KillShrinkingGCTimer();
|
||||
s->SetWantMajorGC(JS::GCReason::USER_INACTIVE);
|
||||
s->EnsureGCRunner(0);
|
||||
if (!s->mUserIsActive) {
|
||||
if (!nsRefreshDriver::IsRegularRateTimerTicking()) {
|
||||
s->SetWantMajorGC(JS::GCReason::USER_INACTIVE);
|
||||
s->EnsureGCRunner(0);
|
||||
} else {
|
||||
s->PokeShrinkingGC();
|
||||
}
|
||||
}
|
||||
},
|
||||
this, StaticPrefs::javascript_options_compact_on_user_inactive_delay(),
|
||||
nsITimer::TYPE_ONE_SHOT_LOW_PRIORITY, "ShrinkingGCTimerFired");
|
||||
|
|
Загрузка…
Ссылка в новой задаче