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

jorlow at chromium.org jorlow at chromium.org
Wed Dec 22 15:30:53 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit be3f42d7b5ac82f99ec188b08399b57d50c3e0c5
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Nov 5 13:57:26 2010 +0000

    2010-10-27  Jeremy Orlow  <jorlow at chromium.org>
    
            Reviewed by Steve Block.
    
            IDBFactoryBackend's reference to IDBDatabaseBackend should be weak
            https://bugs.webkit.org/show_bug.cgi?id=48416
    
            The factory's lifetime is that of the application, so without making
            this weak, IDBDatabaseBackend's will never be closed until the app
            terminates.
    
            * storage/IDBDatabaseBackendImpl.cpp:
            (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
            (WebCore::IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl):
            * storage/IDBDatabaseBackendImpl.h:
            (WebCore::IDBDatabaseBackendImpl::create):
            * storage/IDBFactoryBackendImpl.cpp:
            (WebCore::IDBFactoryBackendImpl::removeIDBDatabaseBackend):
            (WebCore::IDBFactoryBackendImpl::removeSQLiteDatabase):
            (WebCore::IDBFactoryBackendImpl::open):
            * storage/IDBFactoryBackendImpl.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71411 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b38590b..a41da6f 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -2,6 +2,28 @@
 
         Reviewed by Steve Block.
 
+        IDBFactoryBackend's reference to IDBDatabaseBackend should be weak
+        https://bugs.webkit.org/show_bug.cgi?id=48416
+
+        The factory's lifetime is that of the application, so without making
+        this weak, IDBDatabaseBackend's will never be closed until the app
+        terminates.
+
+        * storage/IDBDatabaseBackendImpl.cpp:
+        (WebCore::IDBDatabaseBackendImpl::IDBDatabaseBackendImpl):
+        (WebCore::IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl):
+        * storage/IDBDatabaseBackendImpl.h:
+        (WebCore::IDBDatabaseBackendImpl::create):
+        * storage/IDBFactoryBackendImpl.cpp:
+        (WebCore::IDBFactoryBackendImpl::removeIDBDatabaseBackend):
+        (WebCore::IDBFactoryBackendImpl::removeSQLiteDatabase):
+        (WebCore::IDBFactoryBackendImpl::open):
+        * storage/IDBFactoryBackendImpl.h:
+
+2010-10-27  Jeremy Orlow  <jorlow at chromium.org>
+
+        Reviewed by Steve Block.
+
         IDBObjectStoreBackend and IDBIndexBackend should not depend on IDBDatabaseBackend
         https://bugs.webkit.org/show_bug.cgi?id=48410
 
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.cpp b/WebCore/storage/IDBDatabaseBackendImpl.cpp
index 3bee8fe..156a21d 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.cpp
+++ b/WebCore/storage/IDBDatabaseBackendImpl.cpp
@@ -31,6 +31,7 @@
 #include "CrossThreadTask.h"
 #include "DOMStringList.h"
 #include "IDBDatabaseException.h"
+#include "IDBFactoryBackendImpl.h"
 #include "IDBObjectStoreBackendImpl.h"
 #include "IDBSQLiteDatabase.h"
 #include "IDBTransactionBackendInterface.h"
@@ -88,12 +89,14 @@ static bool setMetaData(SQLiteDatabase& sqliteDatabase, const String& name, cons
     return true;
 }
 
-IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, IDBSQLiteDatabase* sqliteDatabase, IDBTransactionCoordinator* coordinator)
+IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String& description, IDBSQLiteDatabase* sqliteDatabase, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
     : m_sqliteDatabase(sqliteDatabase)
     , m_id(InvalidId)
     , m_name(name)
     , m_description(description)
     , m_version("")
+    , m_identifier(uniqueIdentifier)
+    , m_factory(factory)
     , m_transactionCoordinator(coordinator)
 {
     ASSERT(!m_name.isNull());
@@ -108,6 +111,7 @@ IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, const String&
 
 IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl()
 {
+    m_factory->removeIDBDatabaseBackend(m_identifier);
 }
 
 void IDBDatabaseBackendImpl::setDescription(const String& description)
diff --git a/WebCore/storage/IDBDatabaseBackendImpl.h b/WebCore/storage/IDBDatabaseBackendImpl.h
index 53e1a5f..8c97a70 100644
--- a/WebCore/storage/IDBDatabaseBackendImpl.h
+++ b/WebCore/storage/IDBDatabaseBackendImpl.h
@@ -35,6 +35,7 @@
 
 namespace WebCore {
 
+class IDBFactoryBackendImpl;
 class IDBObjectStoreBackendImpl;
 class IDBSQLiteDatabase;
 class IDBTransactionCoordinator;
@@ -42,9 +43,9 @@ class SQLiteDatabase;
 
 class IDBDatabaseBackendImpl : public IDBDatabaseBackendInterface {
 public:
-    static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, const String& description, IDBSQLiteDatabase* database, IDBTransactionCoordinator* coordinator)
+    static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, const String& description, IDBSQLiteDatabase* database, IDBTransactionCoordinator* coordinator, IDBFactoryBackendImpl* factory, const String& uniqueIdentifier)
     {
-        return adoptRef(new IDBDatabaseBackendImpl(name, description, database, coordinator));
+        return adoptRef(new IDBDatabaseBackendImpl(name, description, database, coordinator, factory, uniqueIdentifier));
     }
     virtual ~IDBDatabaseBackendImpl();
 
@@ -69,7 +70,7 @@ public:
     IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); }
 
 private:
-    IDBDatabaseBackendImpl(const String& name, const String& description, IDBSQLiteDatabase* database, IDBTransactionCoordinator*);
+    IDBDatabaseBackendImpl(const String& name, const String& description, IDBSQLiteDatabase* database, IDBTransactionCoordinator*, IDBFactoryBackendImpl*, const String& uniqueIdentifier);
 
     void loadObjectStores();
 
@@ -88,6 +89,10 @@ private:
     String m_description;
     String m_version;
 
+    String m_identifier;
+    // This might not need to be a RefPtr since the factory's lifetime is that of the page group, but it's better to be conservitive than sorry.
+    RefPtr<IDBFactoryBackendImpl> m_factory;
+
     typedef HashMap<String, RefPtr<IDBObjectStoreBackendImpl> > ObjectStoreMap;
     ObjectStoreMap m_objectStores;
 
diff --git a/WebCore/storage/IDBFactoryBackendImpl.cpp b/WebCore/storage/IDBFactoryBackendImpl.cpp
index 1905c0c..e4d0ee8 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.cpp
+++ b/WebCore/storage/IDBFactoryBackendImpl.cpp
@@ -52,10 +52,16 @@ IDBFactoryBackendImpl::~IDBFactoryBackendImpl()
 {
 }
 
-void IDBFactoryBackendImpl::removeSQLiteDatabase(const String& filePath)
+void IDBFactoryBackendImpl::removeIDBDatabaseBackend(const String& uniqueIdentifier)
 {
-    ASSERT(m_sqliteDatabaseMap.contains(filePath));
-    m_sqliteDatabaseMap.remove(filePath);
+    ASSERT(m_databaseBackendMap.contains(uniqueIdentifier));
+    m_databaseBackendMap.remove(uniqueIdentifier);
+}
+
+void IDBFactoryBackendImpl::removeSQLiteDatabase(const String& uniqueIdentifier)
+{
+    ASSERT(m_sqliteDatabaseMap.contains(uniqueIdentifier));
+    m_sqliteDatabaseMap.remove(uniqueIdentifier);
 }
 
 static PassRefPtr<IDBSQLiteDatabase> openSQLiteDatabase(SecurityOrigin* securityOrigin, const String& pathBase, int64_t maximumSize, const String& fileIdentifier, IDBFactoryBackendImpl* factory)
@@ -124,7 +130,7 @@ void IDBFactoryBackendImpl::open(const String& name, const String& description,
     if (it != m_databaseBackendMap.end()) {
         if (!description.isNull())
             it->second->setDescription(description); // The description may have changed.
-        callbacks->onSuccess(it->second.get());
+        callbacks->onSuccess(it->second);
         return;
     }
 
@@ -144,9 +150,9 @@ void IDBFactoryBackendImpl::open(const String& name, const String& description,
         m_sqliteDatabaseMap.set(fileIdentifier, sqliteDatabase.get());
     }
 
-    RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, description, sqliteDatabase.get(), m_transactionCoordinator.get());
+    RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, description, sqliteDatabase.get(), m_transactionCoordinator.get(), this, uniqueIdentifier);
     callbacks->onSuccess(databaseBackend.get());
-    m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.release());
+    m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get());
 }
 
 String IDBFactoryBackendImpl::databaseFileName(SecurityOrigin* securityOrigin)
diff --git a/WebCore/storage/IDBFactoryBackendImpl.h b/WebCore/storage/IDBFactoryBackendImpl.h
index 381c402..d618fe2 100644
--- a/WebCore/storage/IDBFactoryBackendImpl.h
+++ b/WebCore/storage/IDBFactoryBackendImpl.h
@@ -50,8 +50,9 @@ public:
     }
     virtual ~IDBFactoryBackendImpl();
 
-    // IDBSQLiteDatabase's lifetime may be shorter than ours, so we need notification when it dies.
-    void removeSQLiteDatabase(const String& filePath);
+    // Notifications from weak pointers.
+    void removeIDBDatabaseBackend(const String& uniqueIdentifier);
+    void removeSQLiteDatabase(const String& uniqueIdentifier);
 
     virtual void open(const String& name, const String& description, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, Frame*, const String& dataDir, int64_t maximumSize);
 
@@ -60,8 +61,7 @@ public:
 private:
     IDBFactoryBackendImpl();
 
-    // FIXME: Just hold a weak pointer.
-    typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap;
+    typedef HashMap<String, IDBDatabaseBackendImpl*> IDBDatabaseBackendMap;
     IDBDatabaseBackendMap m_databaseBackendMap;
 
     typedef HashMap<String, IDBSQLiteDatabase*> SQLiteDatabaseMap;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list