зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1371664 P2 Make nsGlobalWindow::SetIsBackground() call new TimeoutManager::UpdateBackgroundState(). r=ehsan
This commit is contained in:
Родитель
3ea8a7a387
Коммит
d959a50dfa
|
@ -1152,6 +1152,14 @@ TimeoutManager::Thaw()
|
|||
});
|
||||
}
|
||||
|
||||
void
|
||||
TimeoutManager::UpdateBackgroundState()
|
||||
{
|
||||
if (!IsBackground()) {
|
||||
ResetTimersForThrottleReduction();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
TimeoutManager::IsTimeoutTracking(uint32_t aTimeoutId)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,10 @@ public:
|
|||
void Freeze();
|
||||
void Thaw();
|
||||
|
||||
// This should be called by nsGlobalWindow when the window might have moved
|
||||
// to the background or foreground.
|
||||
void UpdateBackgroundState();
|
||||
|
||||
// Initialize TimeoutManager before the first time it is accessed.
|
||||
static void Initialize();
|
||||
|
||||
|
|
|
@ -10671,13 +10671,16 @@ void nsGlobalWindow::SetIsBackground(bool aIsBackground)
|
|||
{
|
||||
MOZ_ASSERT(IsOuterWindow());
|
||||
|
||||
bool resetTimers = (!aIsBackground && AsOuter()->IsBackground());
|
||||
bool changed = aIsBackground != AsOuter()->IsBackground();
|
||||
SetIsBackgroundInternal(aIsBackground);
|
||||
|
||||
nsGlobalWindow* inner = GetCurrentInnerWindowInternal();
|
||||
|
||||
if (inner && changed) {
|
||||
inner->mTimeoutManager->UpdateBackgroundState();
|
||||
}
|
||||
|
||||
if (aIsBackground) {
|
||||
MOZ_ASSERT(!resetTimers);
|
||||
// Notify gamepadManager we are at the background window,
|
||||
// we need to stop vibrate.
|
||||
if (inner) {
|
||||
|
@ -10685,9 +10688,6 @@ void nsGlobalWindow::SetIsBackground(bool aIsBackground)
|
|||
}
|
||||
return;
|
||||
} else if (inner) {
|
||||
if (resetTimers) {
|
||||
inner->mTimeoutManager->ResetTimersForThrottleReduction();
|
||||
}
|
||||
inner->SyncGamepadState();
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче