Get rid of IDBFactoryBackendLevelDB and IDBTransactionBackendLevelDB in IDBDatabaseBa...
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Oct 2013 23:23:53 +0000 (23:23 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Oct 2013 23:23:53 +0000 (23:23 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123039

Reviewed by Anders Carlsson.

Source/WebCore:

Add a few concepts to the interfaces to make this work:
* Modules/indexeddb/IDBFactoryBackendInterface.h:
* Modules/indexeddb/IDBTransactionBackendInterface.h:
(WebCore::IDBTransactionBackendInterface::id):
(WebCore::IDBTransactionBackendInterface::IDBTransactionBackendInterface):

Adapt to using Interface ptr’s instead of LevelDB ptr’s:
* Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp:
(WebCore::IDBDatabaseBackendLevelDB::create):
(WebCore::IDBDatabaseBackendLevelDB::IDBDatabaseBackendLevelDB):
(WebCore::IDBDatabaseBackendLevelDB::createObjectStore):
(WebCore::IDBDatabaseBackendLevelDB::deleteObjectStore):
(WebCore::IDBDatabaseBackendLevelDB::createIndex):
(WebCore::IDBDatabaseBackendLevelDB::deleteIndex):
(WebCore::IDBDatabaseBackendLevelDB::get):
(WebCore::IDBDatabaseBackendLevelDB::put):
(WebCore::IDBDatabaseBackendLevelDB::setIndexKeys):
(WebCore::IDBDatabaseBackendLevelDB::setIndexesReady):
(WebCore::IDBDatabaseBackendLevelDB::openCursor):
(WebCore::IDBDatabaseBackendLevelDB::count):
(WebCore::IDBDatabaseBackendLevelDB::deleteRange):
(WebCore::IDBDatabaseBackendLevelDB::clear):
(WebCore::IDBDatabaseBackendLevelDB::transactionStarted):
(WebCore::IDBDatabaseBackendLevelDB::transactionFinished):
(WebCore::IDBDatabaseBackendLevelDB::transactionFinishedAndAbortFired):
(WebCore::IDBDatabaseBackendLevelDB::transactionFinishedAndCompleteFired):
(WebCore::IDBDatabaseBackendLevelDB::runIntVersionChangeTransaction):
* Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h:

* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:

* Modules/indexeddb/leveldb/IDBObjectStoreBackendLevelDB.cpp:
(WebCore::IDBObjectStoreBackendLevelDB::makeIndexWriters):
* Modules/indexeddb/leveldb/IDBObjectStoreBackendLevelDB.h:

* Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.cpp:
(WebCore::IDBTransactionBackendLevelDB::IDBTransactionBackendLevelDB):
(WebCore::IDBTransactionBackendLevelDB::abort):
(WebCore::IDBTransactionBackendLevelDB::commit):
* Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.h:

Source/WebKit2:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
(WebKit::WebIDBFactoryBackend::removeIDBDatabaseBackend): Stub out this new interface method.
* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@157651 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h
Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h
Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h
Source/WebCore/Modules/indexeddb/leveldb/IDBObjectStoreBackendLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBObjectStoreBackendLevelDB.h
Source/WebCore/Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h

index 9bb0d23..8a09a9f 100644 (file)
@@ -1,3 +1,51 @@
+2013-10-18  Brady Eidson  <beidson@apple.com>
+
+        Get rid of IDBFactoryBackendLevelDB and IDBTransactionBackendLevelDB in IDBDatabaseBackendLevelDB.
+        https://bugs.webkit.org/show_bug.cgi?id=123039
+
+        Reviewed by Anders Carlsson.
+
+        Add a few concepts to the interfaces to make this work:
+        * Modules/indexeddb/IDBFactoryBackendInterface.h:
+        * Modules/indexeddb/IDBTransactionBackendInterface.h:
+        (WebCore::IDBTransactionBackendInterface::id):
+        (WebCore::IDBTransactionBackendInterface::IDBTransactionBackendInterface):
+
+        Adapt to using Interface ptr’s instead of LevelDB ptr’s:
+        * Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp:
+        (WebCore::IDBDatabaseBackendLevelDB::create):
+        (WebCore::IDBDatabaseBackendLevelDB::IDBDatabaseBackendLevelDB):
+        (WebCore::IDBDatabaseBackendLevelDB::createObjectStore):
+        (WebCore::IDBDatabaseBackendLevelDB::deleteObjectStore):
+        (WebCore::IDBDatabaseBackendLevelDB::createIndex):
+        (WebCore::IDBDatabaseBackendLevelDB::deleteIndex):
+        (WebCore::IDBDatabaseBackendLevelDB::get):
+        (WebCore::IDBDatabaseBackendLevelDB::put):
+        (WebCore::IDBDatabaseBackendLevelDB::setIndexKeys):
+        (WebCore::IDBDatabaseBackendLevelDB::setIndexesReady):
+        (WebCore::IDBDatabaseBackendLevelDB::openCursor):
+        (WebCore::IDBDatabaseBackendLevelDB::count):
+        (WebCore::IDBDatabaseBackendLevelDB::deleteRange):
+        (WebCore::IDBDatabaseBackendLevelDB::clear):
+        (WebCore::IDBDatabaseBackendLevelDB::transactionStarted):
+        (WebCore::IDBDatabaseBackendLevelDB::transactionFinished):
+        (WebCore::IDBDatabaseBackendLevelDB::transactionFinishedAndAbortFired):
+        (WebCore::IDBDatabaseBackendLevelDB::transactionFinishedAndCompleteFired):
+        (WebCore::IDBDatabaseBackendLevelDB::runIntVersionChangeTransaction):
+        * Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h:
+
+        * Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
+
+        * Modules/indexeddb/leveldb/IDBObjectStoreBackendLevelDB.cpp:
+        (WebCore::IDBObjectStoreBackendLevelDB::makeIndexWriters):
+        * Modules/indexeddb/leveldb/IDBObjectStoreBackendLevelDB.h:
+
+        * Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.cpp:
+        (WebCore::IDBTransactionBackendLevelDB::IDBTransactionBackendLevelDB):
+        (WebCore::IDBTransactionBackendLevelDB::abort):
+        (WebCore::IDBTransactionBackendLevelDB::commit):
+        * Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.h:
+
 2013-10-18  Dean Jackson  <dino@apple.com>
 
         Unable to upload <img src="foo.svg"> as WebGL texture
index 23b7c21..aa1c480 100644 (file)
@@ -56,6 +56,8 @@ public:
     virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
     virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
     virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) = 0;
+
+    virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) = 0;
 };
 
 } // namespace WebCore
index 1685310..bd3a973 100644 (file)
 
 namespace WebCore {
 
+class IDBBackingStore; // FIXME: IDBBackingStore is actually a LevelDB type doesn't belong in the cross-platform directory.
 class IDBCallbacks;
 class IDBDatabaseCallbacks;
+class IDBDatabaseError;
 class IDBKey;
 class IDBKeyRange;
 
@@ -47,7 +49,13 @@ struct IDBObjectStoreMetadata;
 class IDBTransactionBackendInterface : public RefCounted<IDBTransactionBackendInterface> {
 public:
     virtual ~IDBTransactionBackendInterface() { }
-    
+
+    virtual IndexedDB::TransactionMode mode() const = 0;
+
+    virtual void commit() = 0;
+    virtual void abort() = 0;
+    virtual void abort(PassRefPtr<IDBDatabaseError>) = 0;
+
     virtual void scheduleCreateObjectStoreOperation(const IDBObjectStoreMetadata&) = 0;
     virtual void scheduleDeleteObjectStoreOperation(const IDBObjectStoreMetadata&) = 0;
     virtual void scheduleVersionChangeOperation(int64_t transactionId, int64_t requestedVersion, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const IDBDatabaseMetadata&) = 0;
@@ -60,6 +68,21 @@ public:
     virtual void scheduleCountOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0;
     virtual void scheduleDeleteRangeOperation(int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0;
     virtual void scheduleClearOperation(int64_t objectStoreId, PassRefPtr<IDBCallbacks>) = 0;
+
+    // FIXME: IDBBackingStore is actually a LevelDB type, but probably doesn't warrant abstraction.
+    // This is to keep the build working until this requirement can be removed.
+    virtual IDBBackingStore::Transaction* backingStoreTransaction() = 0;
+
+    int64_t id() const { return m_id; }
+
+protected:
+    IDBTransactionBackendInterface(int64_t id)
+        : m_id(id)
+    {
+    }
+
+private:
+    int64_t m_id;
 };
 
 } // namespace WebCore
index 5ce87d4..285722b 100644 (file)
@@ -42,7 +42,7 @@
 
 namespace WebCore {
 
-PassRefPtr<IDBDatabaseBackendLevelDB> IDBDatabaseBackendLevelDB::create(const String& name, IDBBackingStore* database, IDBFactoryBackendLevelDB* factory, const String& uniqueIdentifier)
+PassRefPtr<IDBDatabaseBackendLevelDB> IDBDatabaseBackendLevelDB::create(const String& name, IDBBackingStore* database, IDBFactoryBackendInterface* factory, const String& uniqueIdentifier)
 {
     RefPtr<IDBDatabaseBackendLevelDB> backend = adoptRef(new IDBDatabaseBackendLevelDB(name, database, factory, uniqueIdentifier));
     if (!backend->openInternal())
@@ -50,7 +50,7 @@ PassRefPtr<IDBDatabaseBackendLevelDB> IDBDatabaseBackendLevelDB::create(const St
     return backend.release();
 }
 
-IDBDatabaseBackendLevelDB::IDBDatabaseBackendLevelDB(const String& name, IDBBackingStore* backingStore, IDBFactoryBackendLevelDB* factory, const String& uniqueIdentifier)
+IDBDatabaseBackendLevelDB::IDBDatabaseBackendLevelDB(const String& name, IDBBackingStore* backingStore, IDBFactoryBackendInterface* factory, const String& uniqueIdentifier)
     : m_backingStore(backingStore)
     , m_metadata(name, InvalidId, 0, InvalidId)
     , m_identifier(uniqueIdentifier)
@@ -126,7 +126,7 @@ PassRefPtr<IDBBackingStore> IDBDatabaseBackendLevelDB::backingStore() const
 void IDBDatabaseBackendLevelDB::createObjectStore(int64_t transactionId, int64_t objectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::createObjectStore");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
@@ -141,7 +141,7 @@ void IDBDatabaseBackendLevelDB::createObjectStore(int64_t transactionId, int64_t
 void IDBDatabaseBackendLevelDB::deleteObjectStore(int64_t transactionId, int64_t objectStoreId)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::deleteObjectStore");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
@@ -156,7 +156,7 @@ void IDBDatabaseBackendLevelDB::deleteObjectStore(int64_t transactionId, int64_t
 void IDBDatabaseBackendLevelDB::createIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::createIndex");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
@@ -175,7 +175,7 @@ void IDBDatabaseBackendLevelDB::createIndex(int64_t transactionId, int64_t objec
 void IDBDatabaseBackendLevelDB::deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::deleteIndex");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
@@ -215,7 +215,7 @@ void IDBDatabaseBackendLevelDB::abort(int64_t transactionId, PassRefPtr<IDBDatab
 void IDBDatabaseBackendLevelDB::get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBCallbacks> callbacks)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::get");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
 
@@ -225,7 +225,7 @@ void IDBDatabaseBackendLevelDB::get(int64_t transactionId, int64_t objectStoreId
 void IDBDatabaseBackendLevelDB::put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::put");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() != IndexedDB::TransactionReadOnly);
@@ -240,7 +240,7 @@ void IDBDatabaseBackendLevelDB::put(int64_t transactionId, int64_t objectStoreId
 void IDBDatabaseBackendLevelDB::setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::setIndexKeys");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
@@ -286,7 +286,7 @@ void IDBDatabaseBackendLevelDB::setIndexesReady(int64_t transactionId, int64_t,
 {
     LOG(StorageAPI, "IDBObjectStoreBackendLevelDB::setIndexesReady");
 
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
 
@@ -296,7 +296,7 @@ void IDBDatabaseBackendLevelDB::setIndexesReady(int64_t transactionId, int64_t,
 void IDBDatabaseBackendLevelDB::openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirection direction, bool keyOnly, TaskType taskType, PassRefPtr<IDBCallbacks> callbacks)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::openCursor");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
 
@@ -306,7 +306,7 @@ void IDBDatabaseBackendLevelDB::openCursor(int64_t transactionId, int64_t object
 void IDBDatabaseBackendLevelDB::count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::count");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
 
@@ -318,7 +318,7 @@ void IDBDatabaseBackendLevelDB::count(int64_t transactionId, int64_t objectStore
 void IDBDatabaseBackendLevelDB::deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::deleteRange");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() != IndexedDB::TransactionReadOnly);
@@ -329,7 +329,7 @@ void IDBDatabaseBackendLevelDB::deleteRange(int64_t transactionId, int64_t objec
 void IDBDatabaseBackendLevelDB::clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
 {
     LOG(StorageAPI, "IDBDatabaseBackendLevelDB::clear");
-    IDBTransactionBackendLevelDB* transaction = m_transactions.get(transactionId);
+    IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
     ASSERT(transaction->mode() != IndexedDB::TransactionReadOnly);
@@ -337,18 +337,17 @@ void IDBDatabaseBackendLevelDB::clear(int64_t transactionId, int64_t objectStore
     transaction->scheduleClearOperation(objectStoreId, callbacks);
 }
 
-void IDBDatabaseBackendLevelDB::transactionStarted(PassRefPtr<IDBTransactionBackendLevelDB> prpTransaction)
+void IDBDatabaseBackendLevelDB::transactionStarted(IDBTransactionBackendInterface* transaction)
 {
-    RefPtr<IDBTransactionBackendLevelDB> transaction = prpTransaction;
     if (transaction->mode() == IndexedDB::TransactionVersionChange) {
         ASSERT(!m_runningVersionChangeTransaction);
         m_runningVersionChangeTransaction = transaction;
     }
 }
 
-void IDBDatabaseBackendLevelDB::transactionFinished(PassRefPtr<IDBTransactionBackendLevelDB> prpTransaction)
+void IDBDatabaseBackendLevelDB::transactionFinished(IDBTransactionBackendInterface* rawTransaction)
 {
-    RefPtr<IDBTransactionBackendLevelDB> transaction = prpTransaction;
+    RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
     ASSERT(m_transactions.contains(transaction->id()));
     ASSERT(m_transactions.get(transaction->id()) == transaction.get());
     m_transactions.remove(transaction->id());
@@ -358,9 +357,9 @@ void IDBDatabaseBackendLevelDB::transactionFinished(PassRefPtr<IDBTransactionBac
     }
 }
 
-void IDBDatabaseBackendLevelDB::transactionFinishedAndAbortFired(PassRefPtr<IDBTransactionBackendLevelDB> prpTransaction)
+void IDBDatabaseBackendLevelDB::transactionFinishedAndAbortFired(IDBTransactionBackendInterface* rawTransaction)
 {
-    RefPtr<IDBTransactionBackendLevelDB> transaction = prpTransaction;
+    RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
     if (transaction->mode() == IndexedDB::TransactionVersionChange) {
         // If this was an open-with-version call, there will be a "second
         // half" open call waiting for us in processPendingCalls.
@@ -373,9 +372,9 @@ void IDBDatabaseBackendLevelDB::transactionFinishedAndAbortFired(PassRefPtr<IDBT
     }
 }
 
-void IDBDatabaseBackendLevelDB::transactionFinishedAndCompleteFired(PassRefPtr<IDBTransactionBackendLevelDB> prpTransaction)
+void IDBDatabaseBackendLevelDB::transactionFinishedAndCompleteFired(IDBTransactionBackendInterface* rawTransaction)
 {
-    RefPtr<IDBTransactionBackendLevelDB> transaction = prpTransaction;
+    RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
     if (transaction->mode() == IndexedDB::TransactionVersionChange)
         processPendingCalls();
 }
@@ -526,7 +525,7 @@ void IDBDatabaseBackendLevelDB::runIntVersionChangeTransaction(PassRefPtr<IDBCal
 
     Vector<int64_t> objectStoreIds;
     createTransaction(transactionId, databaseCallbacks, objectStoreIds, IndexedDB::TransactionVersionChange);
-    RefPtr<IDBTransactionBackendLevelDB> transaction = m_transactions.get(transactionId);
+    RefPtr<IDBTransactionBackendInterface> transaction = m_transactions.get(transactionId);
 
     transaction->scheduleVersionChangeOperation(transactionId, requestedVersion, callbacks, databaseCallbacks, m_metadata);
 
index fd97fb9..6d7c3e4 100644 (file)
@@ -39,13 +39,13 @@ namespace WebCore {
 
 class IDBBackingStore;
 class IDBDatabase;
-class IDBFactoryBackendLevelDB;
-class IDBTransactionBackendLevelDB;
+class IDBFactoryBackendInterface;
+class IDBTransactionBackendInterface;
 class IDBTransactionCoordinatorLevelDB;
 
 class IDBDatabaseBackendLevelDB : public IDBDatabaseBackendInterface {
 public:
-    static PassRefPtr<IDBDatabaseBackendLevelDB> create(const String& name, IDBBackingStore* database, IDBFactoryBackendLevelDB*, const String& uniqueIdentifier);
+    static PassRefPtr<IDBDatabaseBackendLevelDB> create(const String& name, IDBBackingStore* database, IDBFactoryBackendInterface*, const String& uniqueIdentifier);
     virtual ~IDBDatabaseBackendLevelDB();
 
     PassRefPtr<IDBBackingStore> backingStore() const;
@@ -75,10 +75,10 @@ public:
     virtual void deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId);
 
     IDBTransactionCoordinatorLevelDB* transactionCoordinator() const { return m_transactionCoordinator.get(); }
-    void transactionStarted(PassRefPtr<IDBTransactionBackendLevelDB>);
-    void transactionFinished(PassRefPtr<IDBTransactionBackendLevelDB>);
-    void transactionFinishedAndCompleteFired(PassRefPtr<IDBTransactionBackendLevelDB>);
-    void transactionFinishedAndAbortFired(PassRefPtr<IDBTransactionBackendLevelDB>);
+    void transactionStarted(IDBTransactionBackendInterface*);
+    void transactionFinished(IDBTransactionBackendInterface*);
+    void transactionFinishedAndCompleteFired(IDBTransactionBackendInterface*);
+    void transactionFinishedAndAbortFired(IDBTransactionBackendInterface*);
 
     virtual void get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, bool keyOnly, PassRefPtr<IDBCallbacks>) OVERRIDE;
     virtual void put(int64_t transactionId, int64_t objectStoreId, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey>, PutMode, PassRefPtr<IDBCallbacks>, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&) OVERRIDE;
@@ -93,7 +93,7 @@ public:
     class VersionChangeAbortOperation;
 
 private:
-    IDBDatabaseBackendLevelDB(const String& name, IDBBackingStore* database, IDBFactoryBackendLevelDB*, const String& uniqueIdentifier);
+    IDBDatabaseBackendLevelDB(const String& name, IDBBackingStore* database, IDBFactoryBackendInterface*, const String& uniqueIdentifier);
 
     bool openInternal();
     void runIntVersionChangeTransaction(PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, int64_t transactionId, int64_t requestedVersion);
@@ -108,12 +108,12 @@ private:
 
     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<IDBFactoryBackendLevelDB> m_factory;
+    RefPtr<IDBFactoryBackendInterface> m_factory;
 
     OwnPtr<IDBTransactionCoordinatorLevelDB> m_transactionCoordinator;
-    RefPtr<IDBTransactionBackendLevelDB> m_runningVersionChangeTransaction;
+    RefPtr<IDBTransactionBackendInterface> m_runningVersionChangeTransaction;
 
-    typedef HashMap<int64_t, IDBTransactionBackendLevelDB*> TransactionMap;
+    typedef HashMap<int64_t, IDBTransactionBackendInterface*> TransactionMap;
     TransactionMap m_transactions;
 
     class PendingOpenCall {
index afd910f..d820f5b 100644 (file)
@@ -56,7 +56,7 @@ public:
     virtual ~IDBFactoryBackendLevelDB();
 
     // Notifications from weak pointers.
-    virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier);
+    virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) OVERRIDE FINAL;
 
     virtual void getDatabaseNames(PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir);
     virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir);
index c00552e..753515d 100644 (file)
@@ -89,7 +89,7 @@ bool IDBObjectStoreBackendLevelDB::IndexWriter::addingKeyAllowed(IDBBackingStore
     return true;
 }
 
-bool IDBObjectStoreBackendLevelDB::makeIndexWriters(PassRefPtr<IDBTransactionBackendLevelDB> transaction, IDBBackingStore* backingStore, int64_t databaseId, const IDBObjectStoreMetadata& objectStore, PassRefPtr<IDBKey> primaryKey, bool keyWasGenerated, const Vector<int64_t>& indexIds, const Vector<IDBDatabaseBackendInterface::IndexKeys>& indexKeys, Vector<OwnPtr<IndexWriter> >* indexWriters, String* errorMessage, bool& completed)
+bool IDBObjectStoreBackendLevelDB::makeIndexWriters(PassRefPtr<IDBTransactionBackendInterface> transaction, IDBBackingStore* backingStore, int64_t databaseId, const IDBObjectStoreMetadata& objectStore, PassRefPtr<IDBKey> primaryKey, bool keyWasGenerated, const Vector<int64_t>& indexIds, const Vector<IDBDatabaseBackendInterface::IndexKeys>& indexKeys, Vector<OwnPtr<IndexWriter>>* indexWriters, String* errorMessage, bool& completed)
 {
     ASSERT(indexIds.size() == indexKeys.size());
     completed = false;
index d09b6e7..c6b36b0 100644 (file)
@@ -66,7 +66,7 @@ namespace IDBObjectStoreBackendLevelDB {
         IDBDatabaseBackendInterface::IndexKeys m_indexKeys;
     };
 
-    bool makeIndexWriters(PassRefPtr<IDBTransactionBackendLevelDB>, IDBBackingStore*, int64_t databaseId, const IDBObjectStoreMetadata&, PassRefPtr<IDBKey> primaryKey, bool keyWasGenerated, const Vector<int64_t>& indexIds, const Vector<IDBDatabaseBackendInterface::IndexKeys>&, Vector<OwnPtr<IndexWriter> >* indexWriters, String* errorMessage, bool& completed) WARN_UNUSED_RETURN;
+    bool makeIndexWriters(PassRefPtr<IDBTransactionBackendInterface>, IDBBackingStore*, int64_t databaseId, const IDBObjectStoreMetadata&, PassRefPtr<IDBKey> primaryKey, bool keyWasGenerated, const Vector<int64_t>& indexIds, const Vector<IDBDatabaseBackendInterface::IndexKeys>&, Vector<OwnPtr<IndexWriter>>* indexWriters, String* errorMessage, bool& completed) WARN_UNUSED_RETURN;
 
     PassRefPtr<IDBKey> generateKey(PassRefPtr<IDBBackingStore>, PassRefPtr<IDBTransactionBackendLevelDB>, int64_t databaseId, int64_t objectStoreId);
     bool updateKeyGenerator(PassRefPtr<IDBBackingStore>, PassRefPtr<IDBTransactionBackendLevelDB>, int64_t databaseId, int64_t objectStoreId, const IDBKey*, bool checkCurrent);
index 4875aa5..e5dbee9 100644 (file)
@@ -50,7 +50,7 @@ PassRefPtr<IDBTransactionBackendLevelDB> IDBTransactionBackendLevelDB::create(ID
 }
 
 IDBTransactionBackendLevelDB::IDBTransactionBackendLevelDB(IDBBackingStore* backingStore, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const HashSet<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode, IDBDatabaseBackendLevelDB* database)
-    : m_id(id)
+    : IDBTransactionBackendInterface(id)
     , m_objectStoreIds(objectStoreIds)
     , m_mode(mode)
     , m_state(Unused)
@@ -136,7 +136,7 @@ void IDBTransactionBackendLevelDB::abort(PassRefPtr<IDBDatabaseError> error)
     m_database->transactionFinished(this);
 
     if (m_callbacks)
-        m_callbacks->onAbort(m_id, error);
+        m_callbacks->onAbort(id(), error);
 
     m_database->transactionFinishedAndAbortFired(this);
 
@@ -222,10 +222,10 @@ void IDBTransactionBackendLevelDB::commit()
     m_database->transactionFinished(this);
 
     if (committed) {
-        m_callbacks->onComplete(m_id);
+        m_callbacks->onComplete(id());
         m_database->transactionFinishedAndCompleteFired(this);
     } else {
-        m_callbacks->onAbort(m_id, IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error committing transaction."));
+        m_callbacks->onAbort(id(), IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error committing transaction."));
         m_database->transactionFinishedAndAbortFired(this);
     }
 
index cd2c075..765a9e6 100644 (file)
@@ -49,8 +49,9 @@ public:
     static PassRefPtr<IDBTransactionBackendLevelDB> create(IDBBackingStore*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, IndexedDB::TransactionMode, IDBDatabaseBackendLevelDB*);
     virtual ~IDBTransactionBackendLevelDB();
 
-    virtual void abort();
-    void commit();
+    virtual void commit() OVERRIDE FINAL;
+    virtual void abort() OVERRIDE FINAL;
+    virtual void abort(PassRefPtr<IDBDatabaseError>) OVERRIDE FINAL;
 
     class Operation {
     public:
@@ -58,9 +59,8 @@ public:
         virtual void perform() = 0;
     };
 
-    void abort(PassRefPtr<IDBDatabaseError>);
     void run();
-    IndexedDB::TransactionMode mode() const { return m_mode; }
+    virtual IndexedDB::TransactionMode mode() const OVERRIDE FINAL { return m_mode; }
     const HashSet<int64_t>& scope() const { return m_objectStoreIds; }
     void scheduleTask(PassOwnPtr<Operation> task, PassOwnPtr<Operation> abortTask = nullptr) { scheduleTask(IDBDatabaseBackendInterface::NormalTask, task, abortTask); }
     void scheduleTask(IDBDatabaseBackendInterface::TaskType, PassOwnPtr<Operation>, PassOwnPtr<Operation> abortTask = nullptr);
@@ -68,8 +68,7 @@ public:
     void unregisterOpenCursor(IDBCursorBackendLevelDB*);
     void addPreemptiveEvent() { m_pendingPreemptiveEvents++; }
     void didCompletePreemptiveEvent() { m_pendingPreemptiveEvents--; ASSERT(m_pendingPreemptiveEvents >= 0); }
-    IDBBackingStore::Transaction* backingStoreTransaction() { return &m_transaction; }
-    int64_t id() const { return m_id; }
+    virtual IDBBackingStore::Transaction* backingStoreTransaction() OVERRIDE FINAL { return &m_transaction; }
 
     IDBDatabaseBackendLevelDB* database() const { return m_database.get(); }
 
@@ -104,7 +103,6 @@ private:
     void taskTimerFired(Timer<IDBTransactionBackendLevelDB>*);
     void closeOpenCursors();
 
-    const int64_t m_id;
     const HashSet<int64_t> m_objectStoreIds;
     const IndexedDB::TransactionMode m_mode;
 
index 4d9bcbf..c4da3e9 100644 (file)
@@ -1,3 +1,14 @@
+2013-10-18  Brady Eidson  <beidson@apple.com>
+
+        Get rid of IDBFactoryBackendLevelDB and IDBTransactionBackendLevelDB in IDBDatabaseBackendLevelDB.
+        https://bugs.webkit.org/show_bug.cgi?id=123039
+
+        Reviewed by Anders Carlsson.
+
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
+        (WebKit::WebIDBFactoryBackend::removeIDBDatabaseBackend): Stub out this new interface method.
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:
+
 2013-10-18  Dan Bernstein  <mitz@apple.com>
 
         [Cocoa] WKBrowsingController accessors crash instead of returning nil
index 1204c28..54f63db 100644 (file)
@@ -94,6 +94,11 @@ void WebIDBFactoryBackend::deleteDatabase(const String&, PassRefPtr<IDBCallbacks
     notImplemented();
 }
 
+void WebIDBFactoryBackend::removeIDBDatabaseBackend(const String&)
+{
+    notImplemented();
+}
+
 } // namespace WebKit
 
 #endif // ENABLE(DATABASE_PROCESS)
index 53990c2..1b2eda9 100644 (file)
@@ -39,9 +39,11 @@ public:
 
     virtual ~WebIDBFactoryBackend();
 
-    virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir);
-    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir);
-    virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir);
+    virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
+    virtual void open(const String& name, int64_t version, int64_t transactionId, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
+    virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
+
+    virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) OVERRIDE FINAL;
 
 private:
     WebIDBFactoryBackend();