Bug 1727972 - Use the user activity flag in the CCGCScheduler r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D123889
This commit is contained in:
Paul Bone 2021-08-30 00:04:56 +00:00
Родитель 4fd2dca330
Коммит 7bb60676ad
2 изменённых файлов: 2 добавлений и 9 удалений

Просмотреть файл

@ -142,6 +142,7 @@ class CCGCScheduler {
void UserIsInactive();
void UserIsActive();
bool IsUserActive() const { return mUserIsActive; }
void KillShrinkingGCTimer();
void KillFullGCTimer();

Просмотреть файл

@ -1612,15 +1612,7 @@ void nsJSContext::MaybeRunNextCollectorSlice(nsIDocShell* aDocShell,
return;
}
// GetLastUserEventTime returns microseconds.
uint32_t lastEventTime = 0;
vm->GetLastUserEventTime(lastEventTime);
uint32_t currentTime = PR_IntervalToMicroseconds(PR_IntervalNow());
// Only try to trigger collectors more often if user hasn't interacted with
// the page for awhile.
if ((currentTime - lastEventTime) >
(StaticPrefs::dom_events_user_interaction_interval() *
PR_USEC_PER_MSEC)) {
if (!sScheduler.IsUserActive()) {
Maybe<TimeStamp> next = nsRefreshDriver::GetNextTickHint();
// Try to not delay the next RefreshDriver tick, so give a reasonable
// deadline for collectors.