mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1234176 - Do not send memory pressure events to applications sent into the background. r=dhylands
This commit is contained in:
parent
c22a6229cd
commit
a9d408188f
@ -692,7 +692,6 @@ pref("layout.css.scroll-snap.enabled", true);
|
||||
pref("dom.ipc.processPriorityManager.enabled", true);
|
||||
pref("dom.ipc.processPriorityManager.backgroundGracePeriodMS", 1000);
|
||||
pref("dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS", 5000);
|
||||
pref("dom.ipc.processPriorityManager.memoryPressureGracePeriodMS", 3000);
|
||||
pref("dom.ipc.processPriorityManager.temporaryPriorityLockMS", 5000);
|
||||
|
||||
// Number of different background/foreground levels for background/foreground
|
||||
|
@ -344,7 +344,6 @@ public:
|
||||
private:
|
||||
static uint32_t sBackgroundPerceivableGracePeriodMS;
|
||||
static uint32_t sBackgroundGracePeriodMS;
|
||||
static uint32_t sMemoryPressureGracePeriodMS;
|
||||
|
||||
void FireTestOnlyObserverNotification(
|
||||
const char* aTopic,
|
||||
@ -369,7 +368,6 @@ private:
|
||||
nsAutoCString mNameWithComma;
|
||||
|
||||
nsCOMPtr<nsITimer> mResetPriorityTimer;
|
||||
nsCOMPtr<nsITimer> mMemoryPressureTimer;
|
||||
};
|
||||
|
||||
/* static */ bool ProcessPriorityManagerImpl::sInitialized = false;
|
||||
@ -382,7 +380,6 @@ private:
|
||||
ProcessPriorityManagerImpl::sSingleton;
|
||||
/* static */ uint32_t ParticularProcessPriorityManager::sBackgroundPerceivableGracePeriodMS = 0;
|
||||
/* static */ uint32_t ParticularProcessPriorityManager::sBackgroundGracePeriodMS = 0;
|
||||
/* static */ uint32_t ParticularProcessPriorityManager::sMemoryPressureGracePeriodMS = 0;
|
||||
|
||||
NS_IMPL_ISUPPORTS(ProcessPriorityManagerImpl,
|
||||
nsIObserver,
|
||||
@ -702,8 +699,6 @@ ParticularProcessPriorityManager::StaticInit()
|
||||
"dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS");
|
||||
Preferences::AddUintVarCache(&sBackgroundGracePeriodMS,
|
||||
"dom.ipc.processPriorityManager.backgroundGracePeriodMS");
|
||||
Preferences::AddUintVarCache(&sMemoryPressureGracePeriodMS,
|
||||
"dom.ipc.processPriorityManager.memoryPressureGracePeriodMS");
|
||||
}
|
||||
|
||||
void
|
||||
@ -1010,28 +1005,17 @@ ParticularProcessPriorityManager::ScheduleResetPriority(TimeoutPref aTimeoutPref
|
||||
}
|
||||
|
||||
LOGP("Scheduling reset timer to fire in %dms.", timeout);
|
||||
mResetPriorityTimer = do_CreateInstance("@mozilla.org/timer;1");
|
||||
mResetPriorityTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
mResetPriorityTimer->InitWithCallback(this, timeout, nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ParticularProcessPriorityManager::Notify(nsITimer* aTimer)
|
||||
{
|
||||
if (mResetPriorityTimer == aTimer) {
|
||||
LOGP("Reset priority timer callback; about to ResetPriorityNow.");
|
||||
ResetPriorityNow();
|
||||
mResetPriorityTimer = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mContentParent && mMemoryPressureTimer == aTimer) {
|
||||
Unused << mContentParent->SendFlushMemory(NS_LITERAL_STRING("lowering-priority"));
|
||||
mMemoryPressureTimer = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_WARNING("Unexpected timer!");
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
LOGP("Reset priority timer callback; about to ResetPriorityNow.");
|
||||
ResetPriorityNow();
|
||||
mResetPriorityTimer = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1156,18 +1140,6 @@ ParticularProcessPriorityManager::SetPriorityNow(ProcessPriority aPriority,
|
||||
NotifyProcessPriorityChanged(this, oldPriority);
|
||||
|
||||
Unused << mContentParent->SendNotifyProcessPriorityChanged(mPriority);
|
||||
|
||||
if (mMemoryPressureTimer) {
|
||||
mMemoryPressureTimer->Cancel();
|
||||
mMemoryPressureTimer = nullptr;
|
||||
}
|
||||
|
||||
if (aPriority < PROCESS_PRIORITY_FOREGROUND) {
|
||||
mMemoryPressureTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
|
||||
mMemoryPressureTimer->InitWithCallback(this,
|
||||
sMemoryPressureGracePeriodMS,
|
||||
nsITimer::TYPE_ONE_SHOT);
|
||||
}
|
||||
}
|
||||
|
||||
FireTestOnlyObserverNotification("process-priority-set",
|
||||
|
Loading…
Reference in New Issue
Block a user