Changeset 79573 in webkit


Ignore:
Timestamp:
Feb 24, 2011 8:56:56 AM (13 years ago)
Author:
Adam Roben
Message:

Change FrameLoadDelegate to support any number of delegates with delayed work to process

This makes our behavior match Mac more closely, and allows us to remove an incorrect
assertion that was firing during some tests. (The assertion was claiming that there was
never more than one delegate with delayed work to process, but that was not the case.)

Fixes <http://webkit.org/b/55146> Assertion failure in FrameLoadDelegate::locationChangeDone
when running http/tests/navigation/back-twice-without-commit.html

Reviewed by Eric Carlson.

  • DumpRenderTree/win/FrameLoadDelegate.cpp:

(delegatesWithDelayedWork): Added. Returns all FrameLoadDelegates that have delayed work to
process. A single delegate may appear in this Vector more than once (just as, on Mac, a
single delegate may have multiple performSelector requests).
(processWorkTimer): Pass the HWND to ::KillTimer, for pedantic brownie points. Added an
assertion that the timer firing is the shared process work timer. Instead of using the
single, global "delegate waiting for timer" delegate, give all delegates that have delayed
work to process a chance to process their work.
(FrameLoadDelegate::locationChangeDone): If we don't already have an active timer for
processing delayed work, create one. Then add ourselves to the delegatesWithDelayedWork
Vector so our processWork function will be called when the timer fires.

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r79570 r79573  
     12011-02-24  Adam Roben  <aroben@apple.com>
     2
     3        Change FrameLoadDelegate to support any number of delegates with delayed work to process
     4
     5        This makes our behavior match Mac more closely, and allows us to remove an incorrect
     6        assertion that was firing during some tests. (The assertion was claiming that there was
     7        never more than one delegate with delayed work to process, but that was not the case.)
     8
     9        Fixes <http://webkit.org/b/55146> Assertion failure in FrameLoadDelegate::locationChangeDone
     10        when running http/tests/navigation/back-twice-without-commit.html
     11
     12        Reviewed by Eric Carlson.
     13
     14        * DumpRenderTree/win/FrameLoadDelegate.cpp:
     15        (delegatesWithDelayedWork): Added. Returns all FrameLoadDelegates that have delayed work to
     16        process. A single delegate may appear in this Vector more than once (just as, on Mac, a
     17        single delegate may have multiple performSelector requests).
     18        (processWorkTimer): Pass the HWND to ::KillTimer, for pedantic brownie points. Added an
     19        assertion that the timer firing is the shared process work timer. Instead of using the
     20        single, global "delegate waiting for timer" delegate, give all delegates that have delayed
     21        work to process a chance to process their work.
     22        (FrameLoadDelegate::locationChangeDone): If we don't already have an active timer for
     23        processing delayed work, create one. Then add ourselves to the delegatesWithDelayedWork
     24        Vector so our processWork function will be called when the timer fires.
     25
    1262011-02-24  Vsevolod Vlasov  <vsevik@chromium.org>
    227
  • trunk/Tools/DumpRenderTree/win/FrameLoadDelegate.cpp

    r59938 r79573  
    207207}
    208208
    209 static void CALLBACK processWorkTimer(HWND, UINT, UINT_PTR id, DWORD)
    210 {
    211     ::KillTimer(0, id);
    212     FrameLoadDelegate* d = g_delegateWaitingOnTimer;
    213     g_delegateWaitingOnTimer = 0;
    214     d->processWork();
     209typedef Vector<COMPtr<FrameLoadDelegate> > DelegateVector;
     210static DelegateVector& delegatesWithDelayedWork()
     211{
     212    DEFINE_STATIC_LOCAL(DelegateVector, delegates, ());
     213    return delegates;
     214}
     215
     216static UINT_PTR processWorkTimerID;
     217
     218static void CALLBACK processWorkTimer(HWND hwnd, UINT, UINT_PTR id, DWORD)
     219{
     220    ASSERT_ARG(id, id == processWorkTimerID);
     221    ::KillTimer(hwnd, id);
     222    processWorkTimerID = 0;
     223
     224    DelegateVector delegates;
     225    delegates.swap(delegatesWithDelayedWork());
     226
     227    for (size_t i = 0; i < delegates.size(); ++i)
     228        delegates[i]->processWork();
    215229}
    216230
     
    227241
    228242    if (WorkQueue::shared()->count()) {
    229         ASSERT(!g_delegateWaitingOnTimer);
    230         g_delegateWaitingOnTimer = this;
    231         ::SetTimer(0, 0, 0, processWorkTimer);
     243        if (!processWorkTimerID)
     244            processWorkTimerID = ::SetTimer(0, 0, 0, processWorkTimer);
     245        delegatesWithDelayedWork().append(this);
    232246        return;
    233247    }
Note: See TracChangeset for help on using the changeset viewer.