Changeset 20267 in webkit


Ignore:
Timestamp:
Mar 17, 2007 5:54:44 PM (17 years ago)
Author:
hyatt
Message:

Tweaks to prevent timers from starving user input or painting.

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r20266 r20267  
     12007-03-17  Dave Hyatt  <hyatt@apple.com>
     2
     3        Prevent starvation of user input and painting when processing timers.
     4        If we are already in the processing of a custom timer message, don't allow that
     5        processing to do another PostMessage.  Force SetTimer to be used instead.
     6     
     7        Reviewed by ggaren
     8
     9       * platform/win/SharedTimerWin.cpp:
     10        (WebCore::TimerWindowWndProc):
     11        (WebCore::setSharedTimerFireTime):
     12
    1132007-03-17  Geoffrey Garen  <ggaren@apple.com>
    214
  • trunk/WebCore/platform/win/SharedTimerWin.cpp

    r16515 r20267  
    4141static UINT timerFiredMessage = 0;
    4242const LPCWSTR kTimerWindowClassName = L"TimerWindowClass";
     43static bool processingCustomTimerMessage = false;
    4344
    4445LRESULT CALLBACK TimerWindowWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    4546{
    46     if (message == timerFiredMessage)
     47    if (message == timerFiredMessage) {
     48        processingCustomTimerMessage = true;
    4749        sharedTimerFiredFunction();
    48     else
     50        processingCustomTimerMessage = false;
     51    } else
    4952        return DefWindowProc(hWnd, message, wParam, lParam);
    5053    return 0;
     
    9598    }
    9699
    97     if (timerID)
     100    if (timerID) {
    98101        KillTimer(0, timerID);
     102        timerID = 0;
     103    }
    99104
    100     if (intervalInMS == 0) {
    101         timerID = 0;
     105    // We don't allow nested PostMessages, since the custom messages will effectively starve
     106    // painting and user input. (Win32 has a tri-level queue with application messages >
     107    // user input > WM_PAINT/WM_TIMER.)
     108    if (intervalInMS < USER_TIMER_MINIMUM && !processingCustomTimerMessage) {
    102109        // Windows SetTimer does not allow timeouts smaller than 10ms (USER_TIMER_MINIMUM)
    103110        initializeOffScreenTimerWindow();
    104111        PostMessage(timerWindowHandle, timerFiredMessage, 0, 0);
    105112    } else
    106         // FIXME: 1-9ms timeouts may fire too late.
    107113        timerID = SetTimer(0, 0, intervalInMS, timerFired);
    108114}
Note: See TracChangeset for help on using the changeset viewer.