Changeset 74303 in webkit


Ignore:
Timestamp:
Dec 17, 2010 5:07:25 PM (13 years ago)
Author:
andersca@apple.com
Message:

2010-12-17 Anders Carlsson <andersca@apple.com>

Reviewed by Sam Weinig.

Resizing a WKView while loading a page can leave the page at a size that doesn't match the window
https://bugs.webkit.org/show_bug.cgi?id=51282
<rdar://problem/8133142>

Fix a race condition in waitForMessage. If we time out on the wait condition, we would keep the
m_waitForMessageMutex mutex unlocked for a brief period of time before taking the lock again and
then removing the messageID/destinationID pair from the hash map. Under some circumstances, the
connection queue would update the hash map right before we removed it, leading to a lost message.

  • Platform/CoreIPC/Connection.cpp: (CoreIPC::Connection::waitForMessage):
Location:
trunk/WebKit2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r74300 r74303  
     12010-12-17  Anders Carlsson  <andersca@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Resizing a WKView while loading a page can leave the page at a size that doesn't match the window
     6        https://bugs.webkit.org/show_bug.cgi?id=51282
     7        <rdar://problem/8133142>
     8
     9        Fix a race condition in waitForMessage. If we time out on the wait condition, we would keep the
     10        m_waitForMessageMutex mutex unlocked for a brief period of time before taking the lock again and
     11        then removing the messageID/destinationID pair from the hash map. Under some circumstances, the
     12        connection queue would update the hash map right before we removed it, leading to a lost message.
     13       
     14        * Platform/CoreIPC/Connection.cpp:
     15        (CoreIPC::Connection::waitForMessage):
     16
    1172010-12-17  Anders Carlsson  <andersca@apple.com>
    218
  • trunk/WebKit2/Platform/CoreIPC/Connection.cpp

    r71931 r74303  
    141141    }
    142142   
    143     bool timedOut = false;
    144    
    145143    // Now wait for it to be set.
    146     while (!timedOut) {
     144    while (true) {
    147145        MutexLocker locker(m_waitForMessageMutex);
    148146
     
    155153        }
    156154       
    157         // We didn't find it, keep waiting.
    158         timedOut = !m_waitForMessageCondition.timedWait(m_waitForMessageMutex, absoluteTime);
    159     }
    160 
    161     // We timed out, now remove the pending wait.
    162     {
    163         MutexLocker locker(m_waitForMessageMutex);
    164         m_waitForMessageMap.remove(messageAndDestination);
     155        // Now we wait.
     156        if (!m_waitForMessageCondition.timedWait(m_waitForMessageMutex, absoluteTime)) {
     157            // We timed out, now remove the pending wait.
     158            m_waitForMessageMap.remove(messageAndDestination);
     159
     160            break;
     161        }
    165162    }
    166163   
Note: See TracChangeset for help on using the changeset viewer.