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
parent 125e37ab61
commit 2e1ecb7814
2 changed files with 16 additions and 2 deletions

View File

@@ -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;