[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

andersca at apple.com andersca at apple.com
Wed Dec 22 14:46:15 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 9570b3bba9de6d945d9ec2dbd8dd938a2a456d2d
Author: andersca at apple.com <andersca at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Oct 19 21:11:29 2010 +0000

    Stop waiting for sync replies if the connection is closed
    https://bugs.webkit.org/show_bug.cgi?id=47930
    
    Reviewed by Adam Roben.
    
    * Platform/CoreIPC/Connection.cpp:
    (CoreIPC::Connection::Connection):
    Initialize m_shouldWaitForSyncReplies to true.
    
    (CoreIPC::Connection::sendSyncMessage):
    Don't attempt to send a message if m_shouldWaitForSyncReplies is false.
    
    (CoreIPC::Connection::waitForSyncReply):
    Return if m_shouldWaitForSyncReplies was set to false.
    
    (CoreIPC::Connection::connectionDidClose):
    Set m_shouldWaitForSyncReplies to true and signal the semaphore.
    
    * Platform/CoreIPC/Connection.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70085 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index 4158776..6d063a8 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,25 @@
+2010-10-19  Anders Carlsson  <andersca at apple.com>
+
+        Reviewed by Adam Roben.
+
+        Stop waiting for sync replies if the connection is closed
+        https://bugs.webkit.org/show_bug.cgi?id=47930
+
+        * Platform/CoreIPC/Connection.cpp:
+        (CoreIPC::Connection::Connection):
+        Initialize m_shouldWaitForSyncReplies to true.
+
+        (CoreIPC::Connection::sendSyncMessage):
+        Don't attempt to send a message if m_shouldWaitForSyncReplies is false.
+
+        (CoreIPC::Connection::waitForSyncReply):
+        Return if m_shouldWaitForSyncReplies was set to false.
+
+        (CoreIPC::Connection::connectionDidClose):
+        Set m_shouldWaitForSyncReplies to true and signal the semaphore.
+
+        * Platform/CoreIPC/Connection.h:
+
 2010-10-19  Adam Roben  <aroben at apple.com>
 
         Windows build fix
diff --git a/WebKit2/Platform/CoreIPC/Connection.cpp b/WebKit2/Platform/CoreIPC/Connection.cpp
index 027d7d4..1fefa7e 100644
--- a/WebKit2/Platform/CoreIPC/Connection.cpp
+++ b/WebKit2/Platform/CoreIPC/Connection.cpp
@@ -51,6 +51,7 @@ Connection::Connection(Identifier identifier, bool isServer, Client* client, Run
     , m_isConnected(false)
     , m_connectionQueue("com.apple.CoreIPC.ReceiveQueue")
     , m_clientRunLoop(clientRunLoop)
+    , m_shouldWaitForSyncReplies(true)
 {
     ASSERT(m_client);
 
@@ -165,7 +166,10 @@ PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uin
     
     // Push the pending sync reply information on our stack.
     {
-        MutexLocker locker(m_pendingSyncRepliesMutex);
+        MutexLocker locker(m_syncReplyStateMutex);
+        if (!m_shouldWaitForSyncReplies)
+            return 0;
+
         m_pendingSyncReplies.append(PendingSyncReply(syncRequestID));
     }
     
@@ -177,7 +181,7 @@ PassOwnPtr<ArgumentDecoder> Connection::sendSyncMessage(MessageID messageID, uin
 
     // Finally, pop the pending sync reply information.
     {
-        MutexLocker locker(m_pendingSyncRepliesMutex);
+        MutexLocker locker(m_syncReplyStateMutex);
         ASSERT(m_pendingSyncReplies.last().syncRequestID == syncRequestID);
         m_pendingSyncReplies.removeLast();
     }
@@ -192,7 +196,7 @@ PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID,
     bool timedOut = false;
     while (!timedOut) {
         {
-            MutexLocker locker(m_pendingSyncRepliesMutex);
+            MutexLocker locker(m_syncReplyStateMutex);
 
             // First, check if there is a sync reply at the top of the stack.
             ASSERT(!m_pendingSyncReplies.isEmpty());
@@ -200,8 +204,8 @@ PassOwnPtr<ArgumentDecoder> Connection::waitForSyncReply(uint64_t syncRequestID,
             PendingSyncReply& pendingSyncReply = m_pendingSyncReplies.last();
             ASSERT(pendingSyncReply.syncRequestID == syncRequestID);
             
-            // We found the sync reply, return it.
-            if (pendingSyncReply.didReceiveReply)
+            // We found the sync reply, or the connection was closed.
+            if (pendingSyncReply.didReceiveReply || !m_shouldWaitForSyncReplies)
                 return pendingSyncReply.releaseReplyDecoder();
         }
 
@@ -217,7 +221,7 @@ void Connection::processIncomingMessage(MessageID messageID, PassOwnPtr<Argument
 {
     // Check if this is a sync reply.
     if (messageID == MessageID(CoreIPCMessage::SyncMessageReply)) {
-        MutexLocker locker(m_pendingSyncRepliesMutex);
+        MutexLocker locker(m_syncReplyStateMutex);
         ASSERT(!m_pendingSyncReplies.isEmpty());
 
         PendingSyncReply& pendingSyncReply = m_pendingSyncReplies.last();
@@ -253,7 +257,17 @@ void Connection::connectionDidClose()
 {
     // The connection is now invalid.
     platformInvalidate();
-    
+
+    {
+        MutexLocker locker(m_syncReplyStateMutex);
+
+        ASSERT(m_shouldWaitForSyncReplies);
+        m_shouldWaitForSyncReplies = false;
+
+        if (!m_pendingSyncReplies.isEmpty())
+            m_waitForSyncReplySemaphore.signal();
+    }
+
     m_clientRunLoop->scheduleWork(WorkItem::create(this, &Connection::dispatchConnectionDidClose));
 }
 
diff --git a/WebKit2/Platform/CoreIPC/Connection.h b/WebKit2/Platform/CoreIPC/Connection.h
index 7b3bbff..e514452 100644
--- a/WebKit2/Platform/CoreIPC/Connection.h
+++ b/WebKit2/Platform/CoreIPC/Connection.h
@@ -228,7 +228,8 @@ private:
     
     BinarySemaphore m_waitForSyncReplySemaphore;
 
-    Mutex m_pendingSyncRepliesMutex;
+    Mutex m_syncReplyStateMutex;
+    bool m_shouldWaitForSyncReplies;
     Vector<PendingSyncReply> m_pendingSyncReplies;
 
 #if PLATFORM(MAC)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list