[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

dumi at chromium.org dumi at chromium.org
Thu Apr 8 00:43:12 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 3fc0b2c04c84faa8133285d92e841cb3371e4286
Author: dumi at chromium.org <dumi at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 19 01:27:14 2009 +0000

    Move some code related to database closing from the destructor to
    the close() method. This would allow us to do things such as post
    tasks to other threads when a database closes, which cannot be
    done now, because we cannot increment the ref count to a database
    object when we're in its destructor.
    
    Reviewed by Dmitry Titov.
    
    https://bugs.webkit.org/show_bug.cgi?id=32626
    
    * storage/Database.cpp:
    (WebCore::Database::~Database):
    (WebCore::Database::close):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52367 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a0da1df..0694e82 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2009-12-16  Dumitru Daniliuc  <dumi at chromium.org>
+
+        Reviewed by Dmitry Titov.
+
+        Move some code related to database closing from the destructor to
+        the close() method. This would allow us to do things such as post
+        tasks to other threads when a database closes, which cannot be
+        done now, because we cannot increment the ref count to a database
+        object when we're in its destructor.
+
+        https://bugs.webkit.org/show_bug.cgi?id=32626
+
+        * storage/Database.cpp:
+        (WebCore::Database::~Database):
+        (WebCore::Database::close):
+
 2009-12-18  Jon Honeycutt  <jhoneycutt at apple.com>
 
         REGRESSION(r52233): MSAA: Accessibility role of lists is wrong
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 29dec26..72414b4 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -198,12 +198,6 @@ static void derefDocument(void* document)
 
 Database::~Database()
 {
-    if (m_document->databaseThread())
-        m_document->databaseThread()->unscheduleDatabaseTasks(this);
-
-    DatabaseTracker::tracker().removeOpenDatabase(this);
-    m_document->removeOpenDatabase(this);
-
     // Deref m_document on the main thread.
     callOnMainThread(derefDocument, m_document.release().releaseRef());
 }
@@ -333,29 +327,44 @@ void Database::markAsDeletedAndClose()
     synchronizer.waitForTaskCompletion();
 }
 
+static void documentRemoveOpenDatabase(void* context)
+{
+    ASSERT(isMainThread());
+    Database* database = static_cast<Database*>(context);
+    database->document()->removeOpenDatabase(database);
+    database->deref();
+}
+
 void Database::close()
 {
-    if (m_opened) {
-        ASSERT(m_document->databaseThread());
-        ASSERT(currentThread() == document()->databaseThread()->getThreadID());
-        m_sqliteDatabase.close();
-        m_document->databaseThread()->recordDatabaseClosed(this);
-        m_opened = false;
-
-        {
-            MutexLocker locker(guidMutex());
-
-            HashSet<Database*>* hashSet = guidToDatabaseMap().get(m_guid);
-            ASSERT(hashSet);
-            ASSERT(hashSet->contains(this));
-            hashSet->remove(this);
-            if (hashSet->isEmpty()) {
-                guidToDatabaseMap().remove(m_guid);
-                delete hashSet;
-                guidToVersionMap().remove(m_guid);
-            }
+    if (!m_opened)
+        return;
+
+    ASSERT(m_document->databaseThread());
+    ASSERT(currentThread() == document()->databaseThread()->getThreadID());
+    m_sqliteDatabase.close();
+    m_document->databaseThread()->recordDatabaseClosed(this);
+    m_opened = false;
+
+    {
+        MutexLocker locker(guidMutex());
+
+        HashSet<Database*>* hashSet = guidToDatabaseMap().get(m_guid);
+        ASSERT(hashSet);
+        ASSERT(hashSet->contains(this));
+        hashSet->remove(this);
+        if (hashSet->isEmpty()) {
+            guidToDatabaseMap().remove(m_guid);
+            delete hashSet;
+            guidToVersionMap().remove(m_guid);
         }
     }
+
+    m_document->databaseThread()->unscheduleDatabaseTasks(this);
+
+    DatabaseTracker::tracker().removeOpenDatabase(this);
+    ref();  // deref() called in documentRemoveOpenDatabase()
+    callOnMainThread(documentRemoveOpenDatabase, this);
 }
 
 void Database::stop()

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list