Bug 957346: Extend grace period for perceivable background processes. r=fabrice

This commit is contained in:
Ben Kelly 2014-01-15 18:17:59 -05:00
Родитель c68c15b39b
Коммит bfb523ca41
2 изменённых файлов: 13 добавлений и 2 удалений

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

@ -619,9 +619,11 @@ pref("ui.useOverlayScrollbars", 1);
// Enable the ProcessPriorityManager, and give processes with no visible
// documents a 1s grace period before they're eligible to be marked as
// background.
// background. Background processes that are perceivable due to playing
// media are given a longer grace period to accomodate changing tracks, etc.
pref("dom.ipc.processPriorityManager.enabled", true);
pref("dom.ipc.processPriorityManager.backgroundGracePeriodMS", 1000);
pref("dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS", 5000);
pref("dom.ipc.processPriorityManager.temporaryPriorityLockMS", 5000);
// Number of different background levels for background processes. We use

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

@ -807,7 +807,16 @@ ParticularProcessPriorityManager::ResetPriority()
ProcessPriority processPriority = ComputePriority();
if (mPriority == PROCESS_PRIORITY_UNKNOWN ||
mPriority > processPriority) {
ScheduleResetPriority("backgroundGracePeriodMS");
// Apps set at a perceivable background priority are often playing media.
// Most media will have short gaps while changing tracks between songs,
// switching videos, etc. Give these apps a longer grace period so they
// can get their next track started, if there is one, before getting
// downgraded.
if (mPriority == PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE) {
ScheduleResetPriority("backgroundPerceivableGracePeriodMS");
} else {
ScheduleResetPriority("backgroundGracePeriodMS");
}
return;
}