Changeset 116226 in webkit


Ignore:
Timestamp:
May 5, 2012 12:38:46 PM (12 years ago)
Author:
jonlee@apple.com
Message:

[WK2] Incoming events may be processed out-of-order
https://bugs.webkit.org/show_bug.cgi?id=85696
<rdar://problem/11386129>

Reviewed by Maciej Stachowiak.

All messages go to a single queue that gets iterated over by dispatchMessages(). If an input
event arrives in the middle of a flood of messages, all of them will be dispatched before the
input event is dispatched.

In other words, the first dispatchMessages() call will process all of the messages in the queue,
and all subsequent dispatchMessages() calls will act as no-ops, since there is nothing in the queue.

To fix this, we rename dispatchMessages to dispatchOneMessage, and only process one message at a
time.

  • Platform/CoreIPC/Connection.h: Rename dispatchMessages() to dispatchOneMessage().
  • Platform/CoreIPC/Connection.cpp:

(CoreIPC::Connection::enqueueIncomingMessage): Dispatch a call to dispatchOneMessage() on the
run loop.
(CoreIPC::Connection::dispatchOneMessage): Remove the while(true) loop.

Location:
trunk/Source/WebKit2
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r116205 r116226  
     12012-05-04  Jon Lee  <jonlee@apple.com>
     2
     3        [WK2] Incoming events may be processed out-of-order
     4        https://bugs.webkit.org/show_bug.cgi?id=85696
     5        <rdar://problem/11386129>
     6
     7        Reviewed by Maciej Stachowiak.
     8
     9        All messages go to a single queue that gets iterated over by dispatchMessages(). If an input
     10        event arrives in the middle of a flood of messages, all of them will be dispatched before the
     11        input event is dispatched.
     12
     13        In other words, the first dispatchMessages() call will process all of the messages in the queue,
     14        and all subsequent dispatchMessages() calls will act as no-ops, since there is nothing in the queue.
     15
     16        To fix this, we rename dispatchMessages to dispatchOneMessage, and only process one message at a
     17        time.
     18
     19        * Platform/CoreIPC/Connection.h: Rename dispatchMessages() to dispatchOneMessage().
     20        * Platform/CoreIPC/Connection.cpp:
     21        (CoreIPC::Connection::enqueueIncomingMessage): Dispatch a call to dispatchOneMessage() on the
     22        run loop.
     23        (CoreIPC::Connection::dispatchOneMessage): Remove the while(true) loop.
     24
    1252012-05-04  Gustavo Noronha Silva  <gns@gnome.org>
    226
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.cpp

    r112555 r116226  
    667667    m_incomingMessages.append(incomingMessage);
    668668
    669     m_clientRunLoop->dispatch(bind(&Connection::dispatchMessages, this));
     669    m_clientRunLoop->dispatch(bind(&Connection::dispatchOneMessage, this));
    670670}
    671671
     
    704704}
    705705
    706 void Connection::dispatchMessages()
    707 {
    708     while (true) {
    709         IncomingMessage incomingMessage;
    710 
    711         {
    712             MutexLocker locker(m_incomingMessagesLock);
    713             if (m_incomingMessages.isEmpty())
    714                 break;
    715 
    716             incomingMessage = m_incomingMessages.takeFirst();
    717         }
    718 
    719         dispatchMessage(incomingMessage);
    720     }
     706void Connection::dispatchOneMessage()
     707{
     708    IncomingMessage incomingMessage;
     709
     710    {
     711        MutexLocker locker(m_incomingMessagesLock);
     712        if (m_incomingMessages.isEmpty())
     713            return;
     714
     715        incomingMessage = m_incomingMessages.takeFirst();
     716    }
     717
     718    dispatchMessage(incomingMessage);
    721719}
    722720
  • trunk/Source/WebKit2/Platform/CoreIPC/Connection.h

    r112353 r116226  
    239239    void dispatchConnectionDidClose();
    240240    void dispatchMessage(IncomingMessage&);
    241     void dispatchMessages();
     241    void dispatchOneMessage();
    242242    void dispatchSyncMessage(MessageID, ArgumentDecoder*);
    243243    void didFailToSendSyncMessage();
Note: See TracChangeset for help on using the changeset viewer.