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

mrowe at apple.com mrowe at apple.com
Wed Dec 22 12:37:26 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 4a63af98e6dc9d8210f3cd672ccc694d63beab56
Author: mrowe at apple.com <mrowe at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 26 03:35:10 2010 +0000

    <rdar://problem/8205479> WebCore's icon database often prevents Safari from being killable via sudden termination
    
    Reviewed by Dan Bernstein.
    
    We need to ensure that each call to disableSuddenTermination is balanced by a corresponding call to enableSuddenTermination.
    It's possbile for several calls to IconDatabase::wakeSyncThread to correspond to only a single iteration of the loop within
    IconDatabase::syncThreadMainLoop. This results in the sudden termination disable count growing without bound rather than
    being balanced when the work completes. We can prevent this by ensuring that we only disable sudden termination once for each
    corresponding iteration of the sync thread's main loop.
    
    * loader/icon/IconDatabase.cpp:
    (WebCore::IconDatabase::IconDatabase):
    (WebCore::IconDatabase::wakeSyncThread): Only disable sudden termination if it has not yet been disabled for this iteration of
    the sync thread's main loop.
    (WebCore::IconDatabase::syncThreadMainLoop): Clear the flag indicating that sudden termination has been disabled after reenabling it
    so that future calls to wakeSyncThread disable sudden termination once more.
    * loader/icon/IconDatabase.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66077 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e72c4e9..5a3ee40 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-08-25  Mark Rowe  <mrowe at apple.com>
+
+        Reviewed by Dan Bernstein.
+
+        <rdar://problem/8205479> WebCore's icon database often prevents Safari from being killable via sudden termination
+
+        We need to ensure that each call to disableSuddenTermination is balanced by a corresponding call to enableSuddenTermination.
+        It's possbile for several calls to IconDatabase::wakeSyncThread to correspond to only a single iteration of the loop within
+        IconDatabase::syncThreadMainLoop. This results in the sudden termination disable count growing without bound rather than
+        being balanced when the work completes. We can prevent this by ensuring that we only disable sudden termination once for each
+        corresponding iteration of the sync thread's main loop.
+
+        * loader/icon/IconDatabase.cpp:
+        (WebCore::IconDatabase::IconDatabase):
+        (WebCore::IconDatabase::wakeSyncThread): Only disable sudden termination if it has not yet been disabled for this iteration of
+        the sync thread's main loop.
+        (WebCore::IconDatabase::syncThreadMainLoop): Clear the flag indicating that sudden termination has been disabled after reenabling it
+        so that future calls to wakeSyncThread disable sudden termination once more.
+        * loader/icon/IconDatabase.h:
+
 2010-08-25  Michael Nordman  <michaeln at google.com>
 
         Reviewed by David Levin.
diff --git a/WebCore/loader/icon/IconDatabase.cpp b/WebCore/loader/icon/IconDatabase.cpp
index 50a7228..4899055 100644
--- a/WebCore/loader/icon/IconDatabase.cpp
+++ b/WebCore/loader/icon/IconDatabase.cpp
@@ -763,6 +763,7 @@ IconDatabase::IconDatabase()
     , m_threadTerminationRequested(false)
     , m_removeIconsRequested(false)
     , m_iconURLImportComplete(false)
+    , m_disabledSuddenTerminationForSyncThread(false)
     , m_initialPruningComplete(false)
     , m_client(defaultClient())
     , m_imported(false)
@@ -801,13 +802,17 @@ void IconDatabase::notifyPendingLoadDecisions()
 
 void IconDatabase::wakeSyncThread()
 {
-    // The following is balanced by the call to enableSuddenTermination in the
-    // syncThreadMainLoop function.
-    // FIXME: It would be better to only disable sudden termination if we have
-    // something to write, not just if we have something to read.
-    disableSuddenTermination();
-
     MutexLocker locker(m_syncLock);
+
+    if (!m_disabledSuddenTerminationForSyncThread) {
+        m_disabledSuddenTerminationForSyncThread = true;
+        // The following is balanced by the call to enableSuddenTermination in the
+        // syncThreadMainLoop function.
+        // FIXME: It would be better to only disable sudden termination if we have
+        // something to write, not just if we have something to read.
+        disableSuddenTermination();
+    }
+
     m_syncCondition.signal();
 }
 
@@ -1406,7 +1411,9 @@ void* IconDatabase::syncThreadMainLoop()
             // The following is balanced by the call to disableSuddenTermination in the
             // wakeSyncThread function. Any time we wait on the condition, we also have
             // to enableSuddenTermation, after doing the next batch of work.
+            ASSERT(m_disabledSuddenTerminationForSyncThread);
             enableSuddenTermination();
+            m_disabledSuddenTerminationForSyncThread = false;
         }
 
         m_syncCondition.wait(m_syncLock);
@@ -1423,7 +1430,9 @@ void* IconDatabase::syncThreadMainLoop()
         // The following is balanced by the call to disableSuddenTermination in the
         // wakeSyncThread function. Any time we wait on the condition, we also have
         // to enableSuddenTermation, after doing the next batch of work.
+        ASSERT(m_disabledSuddenTerminationForSyncThread);
         enableSuddenTermination();
+        m_disabledSuddenTerminationForSyncThread = false;
     }
 
     return 0;
diff --git a/WebCore/loader/icon/IconDatabase.h b/WebCore/loader/icon/IconDatabase.h
index 9793d21..6146aa6 100644
--- a/WebCore/loader/icon/IconDatabase.h
+++ b/WebCore/loader/icon/IconDatabase.h
@@ -144,11 +144,12 @@ private:
     String m_databaseDirectory;
     // Holding m_syncLock is required when accessing m_completeDatabasePath
     String m_completeDatabasePath;
-    
+
     bool m_threadTerminationRequested;
     bool m_removeIconsRequested;
     bool m_iconURLImportComplete;
-    
+    bool m_disabledSuddenTerminationForSyncThread;
+
     Mutex m_urlAndIconLock;
     // Holding m_urlAndIconLock is required when accessing any of the following data structures or the objects they contain
     HashMap<String, IconRecord*> m_iconURLToRecordMap;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list