Bug 740883 - Improve DRAW event coalescing behaviour for reduced latency. r=Cwiiis

This commit is contained in:
Kartikaya Gupta 2012-04-10 09:27:04 -05:00
Родитель f4f6a60d05
Коммит 9bb250ac0f
2 изменённых файлов: 16 добавлений и 2 удалений

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

@ -95,7 +95,8 @@ nsAppShell::nsAppShell()
mCondLock("nsAppShell.mCondLock"),
mQueueCond(mCondLock, "nsAppShell.mQueueCond"),
mQueuedDrawEvent(nsnull),
mQueuedViewportEvent(nsnull)
mQueuedViewportEvent(nsnull),
mAllowCoalescingNextDraw(false)
{
gAppShell = this;
}
@ -576,7 +577,15 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
delete mQueuedDrawEvent;
}
mQueuedDrawEvent = ae;
if (mAllowCoalescingNextDraw) {
// if we're not allowing coalescing of this draw event, then
// don't set mQueuedDrawEvent to point to this; that way the
// next draw event that comes in won't kill this one.
mAllowCoalescingNextDraw = true;
mQueuedDrawEvent = nsnull;
} else {
mQueuedDrawEvent = ae;
}
mEventQueue.AppendElement(ae);
break;
@ -588,6 +597,10 @@ nsAppShell::PostEvent(AndroidGeckoEvent *ae)
delete mQueuedViewportEvent;
}
mQueuedViewportEvent = ae;
// temporarily turn off draw-coalescing, so that we process a draw
// event as soon as possible after a viewport change
mAllowCoalescingNextDraw = false;
mEventQueue.AppendElement(ae);
break;

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

@ -102,6 +102,7 @@ protected:
CondVar mQueueCond;
mozilla::AndroidGeckoEvent *mQueuedDrawEvent;
mozilla::AndroidGeckoEvent *mQueuedViewportEvent;
bool mAllowCoalescingNextDraw;
nsTArray<mozilla::AndroidGeckoEvent *> mEventQueue;
nsInterfaceHashtable<nsStringHashKey, nsIObserver> mObserversHash;