зеркало из https://github.com/mozilla/pjs.git
bug 627628 - Throttle the dispatching of starved paints so that time is allowed for the processing of input events between each starved paint. r=roc
This helps maintain responsiveness in cases where input events are being generated very rapidly or where painting is extremely expensive.
This commit is contained in:
Родитель
e4a937dbdf
Коммит
f72449e397
|
@ -3757,9 +3757,11 @@ void nsWindow::DispatchPendingEvents()
|
|||
--recursionBlocker;
|
||||
}
|
||||
|
||||
// Quickly check to see if there are any
|
||||
// paint events pending.
|
||||
if (::GetQueueStatus(QS_PAINT)) {
|
||||
// Quickly check to see if there are any paint events pending,
|
||||
// but only dispatch them if it has been long enough since the
|
||||
// last paint completed.
|
||||
if (::GetQueueStatus(QS_PAINT) &&
|
||||
((TimeStamp::Now() - mLastPaintEndTime).ToMilliseconds() >= 50)) {
|
||||
// Find the top level window.
|
||||
HWND topWnd = WinUtils::GetTopLevelHWND(mWnd);
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
#include "nsWindowDbg.h"
|
||||
#include "cairo.h"
|
||||
#include "nsITimer.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
#ifdef CAIRO_HAS_D2D_SURFACE
|
||||
#include "gfxD2DSurface.h"
|
||||
#endif
|
||||
|
@ -94,6 +96,8 @@ class imgIContainer;
|
|||
|
||||
class nsWindow : public nsBaseWidget
|
||||
{
|
||||
typedef mozilla::TimeStamp TimeStamp;
|
||||
typedef mozilla::TimeDuration TimeDuration;
|
||||
typedef mozilla::widget::WindowHook WindowHook;
|
||||
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_WIN7
|
||||
typedef mozilla::widget::TaskbarWindowPreview TaskbarWindowPreview;
|
||||
|
@ -611,6 +615,10 @@ protected:
|
|||
bool mHasTaskbarIconBeenCreated;
|
||||
#endif
|
||||
|
||||
// The point in time at which the last paint completed. We use this to avoid
|
||||
// painting too rapidly in response to frequent input events.
|
||||
TimeStamp mLastPaintEndTime;
|
||||
|
||||
#ifdef ACCESSIBILITY
|
||||
static BOOL sIsAccessibilityOn;
|
||||
static HINSTANCE sAccLib;
|
||||
|
|
|
@ -605,6 +605,7 @@ bool nsWindow::OnPaint(HDC aDC, PRUint32 aNestingLevel)
|
|||
}
|
||||
|
||||
mPaintDC = nsnull;
|
||||
mLastPaintEndTime = TimeStamp::Now();
|
||||
|
||||
#if defined(WIDGET_DEBUG_OUTPUT)
|
||||
if (debug_WantPaintFlashing())
|
||||
|
|
Загрузка…
Ссылка в новой задаче