Make IDBDatabaseBackendLevelDB.cpp be cross platform
authorbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 18:13:59 +0000 (18:13 +0000)
committerbeidson@apple.com <beidson@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Oct 2013 18:13:59 +0000 (18:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123027

Attentively reviewed by Dean Jackson.

Source/WebCore:

Move it out of the indexeddb/leveldb directory, and rename it to IDBDatabaseBackendImpl.

Project files:
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBDatabaseBackendImpl.cpp: Renamed from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp.
* Modules/indexeddb/IDBDatabaseBackendImpl.h: Renamed from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h.

* Modules/indexeddb/IDBDatabaseBackendInterface.h:
(WebCore::IDBDatabaseBackendInterface::isIDBDatabaseBackendImpl): Add to support a required cast in LevelDB code.

* Modules/indexeddb/IDBFactoryBackendInterface.h:

* Modules/indexeddb/leveldb/IDBCursorBackendLevelDB.cpp:
* Modules/indexeddb/leveldb/IDBCursorBackendLevelDB.h:

* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
(WebCore::IDBFactoryBackendLevelDB::deleteDatabase):
(WebCore::IDBFactoryBackendLevelDB::open):
(WebCore::IDBFactoryBackendLevelDB::maybeCreateTransactionBackend):
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:

* Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp:
* Modules/indexeddb/leveldb/IDBLevelDBCoding.h:

* Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.cpp:
(WebCore::IDBTransactionBackendLevelDB::create):
(WebCore::IDBTransactionBackendLevelDB::IDBTransactionBackendLevelDB):
(WebCore::IDBTransactionBackendLevelDB::scheduleVersionChangeOperation):
* Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.h:

* Modules/indexeddb/leveldb/IDBTransactionBackendLevelDBOperations.cpp:
(WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::perform):
(WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::perform):
* Modules/indexeddb/leveldb/IDBTransactionBackendLevelDBOperations.h:

Source/WebKit2:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
(WebKit::WebIDBFactoryBackend::maybeCreateTransactionBackend):
* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:

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

23 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp [moved from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp with 80% similarity]
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h [moved from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h with 93% similarity]
Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h
Source/WebCore/Modules/indexeddb/IDBFactoryBackendInterface.h
Source/WebCore/Modules/indexeddb/leveldb/IDBCursorBackendLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBCursorBackendLevelDB.h
Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h
Source/WebCore/Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBLevelDBCoding.h
Source/WebCore/Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.h
Source/WebCore/Modules/indexeddb/leveldb/IDBTransactionBackendLevelDBOperations.cpp
Source/WebCore/Modules/indexeddb/leveldb/IDBTransactionBackendLevelDBOperations.h
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp
Source/WebKit2/WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h

index ca4868437bd7dc4cc8e3f10a5840119ba47d9c58..47bee097606d9f8f019a6506cd859325379fe26a 100644 (file)
@@ -765,6 +765,7 @@ set(WebCore_SOURCES
     Modules/indexeddb/IDBCursor.cpp
     Modules/indexeddb/IDBCursorWithValue.cpp
     Modules/indexeddb/IDBDatabase.cpp
+    Modules/indexeddb/IDBDatabaseBackendImpl.cpp
     Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp
     Modules/indexeddb/IDBDatabaseException.cpp
     Modules/indexeddb/IDBEventDispatcher.cpp
@@ -786,7 +787,6 @@ set(WebCore_SOURCES
     Modules/indexeddb/WorkerGlobalScopeIndexedDatabase.cpp
     Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp
     Modules/indexeddb/leveldb/IDBCursorBackendLevelDB.cpp
-    Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp
     Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp
     Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp
     Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.cpp
index c847b290493e37f5c91fa276e3316fb4a68a86d4..02a36bfef6d280007e75d1740e53ef14fbb4b120 100644 (file)
@@ -1,3 +1,50 @@
+2013-10-23  Brady Eidson  <beidson@apple.com>
+
+        Make IDBDatabaseBackendLevelDB.cpp be cross platform
+        https://bugs.webkit.org/show_bug.cgi?id=123027
+
+        Attentively reviewed by Dean Jackson.
+
+        Move it out of the indexeddb/leveldb directory, and rename it to IDBDatabaseBackendImpl.
+
+        Project files:
+        * CMakeLists.txt:
+        * GNUmakefile.list.am:
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * Modules/indexeddb/IDBDatabaseBackendImpl.cpp: Renamed from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp.
+        * Modules/indexeddb/IDBDatabaseBackendImpl.h: Renamed from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h.
+
+        * Modules/indexeddb/IDBDatabaseBackendInterface.h:
+        (WebCore::IDBDatabaseBackendInterface::isIDBDatabaseBackendImpl): Add to support a required cast in LevelDB code.
+
+        * Modules/indexeddb/IDBFactoryBackendInterface.h:
+
+        * Modules/indexeddb/leveldb/IDBCursorBackendLevelDB.cpp:
+        * Modules/indexeddb/leveldb/IDBCursorBackendLevelDB.h:
+
+        * Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
+        (WebCore::IDBFactoryBackendLevelDB::deleteDatabase):
+        (WebCore::IDBFactoryBackendLevelDB::open):
+        (WebCore::IDBFactoryBackendLevelDB::maybeCreateTransactionBackend):
+        * Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
+
+        * Modules/indexeddb/leveldb/IDBLevelDBCoding.cpp:
+        * Modules/indexeddb/leveldb/IDBLevelDBCoding.h:
+
+        * Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.cpp:
+        (WebCore::IDBTransactionBackendLevelDB::create):
+        (WebCore::IDBTransactionBackendLevelDB::IDBTransactionBackendLevelDB):
+        (WebCore::IDBTransactionBackendLevelDB::scheduleVersionChangeOperation):
+        * Modules/indexeddb/leveldb/IDBTransactionBackendLevelDB.h:
+
+        * Modules/indexeddb/leveldb/IDBTransactionBackendLevelDBOperations.cpp:
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeOperation::perform):
+        (WebCore::IDBDatabaseBackendImpl::VersionChangeAbortOperation::perform):
+        * Modules/indexeddb/leveldb/IDBTransactionBackendLevelDBOperations.h:
+
 2013-10-23  Daniel Bates  <dabates@apple.com>
 
         [iOS] Upstream more ARMv7s bits
index d2790004b430cba25c60117d5c468a9aa70d321d..89a8a052f6adc2f06237a15afa3bb7afa1be5a90 100644 (file)
@@ -1802,8 +1802,8 @@ webcore_modules_sources += \
        Source/WebCore/Modules/indexeddb/IDBCursor.h \
        Source/WebCore/Modules/indexeddb/IDBCursorWithValue.cpp \
        Source/WebCore/Modules/indexeddb/IDBCursorWithValue.h \
-       Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp \
-       Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h \
+       Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp \
+       Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h \
        Source/WebCore/Modules/indexeddb/IDBDatabaseBackendInterface.h \
        Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacks.h \
        Source/WebCore/Modules/indexeddb/IDBDatabaseCallbacksImpl.cpp \
similarity index 80%
rename from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.cpp
rename to Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.cpp
index f94458f43b288a0ffe5b59b0627af6f140eb7f1d..be885986c971355bbefe4cae3ab9057a1df4c072 100644 (file)
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "IDBDatabaseBackendLevelDB.h"
+#include "IDBDatabaseBackendImpl.h"
 
 #if ENABLE(INDEXED_DATABASE)
 
 
 namespace WebCore {
 
-PassRefPtr<IDBDatabaseBackendLevelDB> IDBDatabaseBackendLevelDB::create(const String& name, IDBBackingStoreInterface* backingStore, IDBFactoryBackendInterface* factory, const String& uniqueIdentifier)
+PassRefPtr<IDBDatabaseBackendImpl> IDBDatabaseBackendImpl::create(const String& name, IDBBackingStoreInterface* backingStore, IDBFactoryBackendInterface* factory, const String& uniqueIdentifier)
 {
-    RefPtr<IDBDatabaseBackendLevelDB> backend = adoptRef(new IDBDatabaseBackendLevelDB(name, backingStore, factory, uniqueIdentifier));
+    RefPtr<IDBDatabaseBackendImpl> backend = adoptRef(new IDBDatabaseBackendImpl(name, backingStore, factory, uniqueIdentifier));
     if (!backend->openInternal())
         return 0;
     return backend.release();
 }
 
-IDBDatabaseBackendLevelDB::IDBDatabaseBackendLevelDB(const String& name, IDBBackingStoreInterface* backingStore, IDBFactoryBackendInterface* factory, const String& uniqueIdentifier)
+IDBDatabaseBackendImpl::IDBDatabaseBackendImpl(const String& name, IDBBackingStoreInterface* backingStore, IDBFactoryBackendInterface* factory, const String& uniqueIdentifier)
     : m_backingStore(backingStore)
     , m_metadata(name, InvalidId, 0, InvalidId)
     , m_identifier(uniqueIdentifier)
@@ -63,7 +63,7 @@ IDBDatabaseBackendLevelDB::IDBDatabaseBackendLevelDB(const String& name, IDBBack
     ASSERT(!m_metadata.name.isNull());
 }
 
-void IDBDatabaseBackendLevelDB::addObjectStore(const IDBObjectStoreMetadata& objectStore, int64_t newMaxObjectStoreId)
+void IDBDatabaseBackendImpl::addObjectStore(const IDBObjectStoreMetadata& objectStore, int64_t newMaxObjectStoreId)
 {
     ASSERT(!m_metadata.objectStores.contains(objectStore.id));
     if (newMaxObjectStoreId != IDBObjectStoreMetadata::InvalidId) {
@@ -73,13 +73,13 @@ void IDBDatabaseBackendLevelDB::addObjectStore(const IDBObjectStoreMetadata& obj
     m_metadata.objectStores.set(objectStore.id, objectStore);
 }
 
-void IDBDatabaseBackendLevelDB::removeObjectStore(int64_t objectStoreId)
+void IDBDatabaseBackendImpl::removeObjectStore(int64_t objectStoreId)
 {
     ASSERT(m_metadata.objectStores.contains(objectStoreId));
     m_metadata.objectStores.remove(objectStoreId);
 }
 
-void IDBDatabaseBackendLevelDB::addIndex(int64_t objectStoreId, const IDBIndexMetadata& index, int64_t newMaxIndexId)
+void IDBDatabaseBackendImpl::addIndex(int64_t objectStoreId, const IDBIndexMetadata& index, int64_t newMaxIndexId)
 {
     ASSERT(m_metadata.objectStores.contains(objectStoreId));
     IDBObjectStoreMetadata objectStore = m_metadata.objectStores.get(objectStoreId);
@@ -93,7 +93,7 @@ void IDBDatabaseBackendLevelDB::addIndex(int64_t objectStoreId, const IDBIndexMe
     m_metadata.objectStores.set(objectStoreId, objectStore);
 }
 
-void IDBDatabaseBackendLevelDB::removeIndex(int64_t objectStoreId, int64_t indexId)
+void IDBDatabaseBackendImpl::removeIndex(int64_t objectStoreId, int64_t indexId)
 {
     ASSERT(m_metadata.objectStores.contains(objectStoreId));
     IDBObjectStoreMetadata objectStore = m_metadata.objectStores.get(objectStoreId);
@@ -103,7 +103,7 @@ void IDBDatabaseBackendLevelDB::removeIndex(int64_t objectStoreId, int64_t index
     m_metadata.objectStores.set(objectStoreId, objectStore);
 }
 
-bool IDBDatabaseBackendLevelDB::openInternal()
+bool IDBDatabaseBackendImpl::openInternal()
 {
     bool success = false;
     bool ok = m_backingStore->getIDBDatabaseMetaData(m_metadata.name, &m_metadata, success);
@@ -116,18 +116,18 @@ bool IDBDatabaseBackendLevelDB::openInternal()
     return m_backingStore->createIDBDatabaseMetaData(m_metadata.name, String::number(m_metadata.version), m_metadata.version, m_metadata.id);
 }
 
-IDBDatabaseBackendLevelDB::~IDBDatabaseBackendLevelDB()
+IDBDatabaseBackendImpl::~IDBDatabaseBackendImpl()
 {
 }
 
-IDBBackingStoreInterface* IDBDatabaseBackendLevelDB::backingStore() const
+IDBBackingStoreInterface* IDBDatabaseBackendImpl::backingStore() const
 {
     return m_backingStore.get();
 }
 
-void IDBDatabaseBackendLevelDB::createObjectStore(int64_t transactionId, int64_t objectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
+void IDBDatabaseBackendImpl::createObjectStore(int64_t transactionId, int64_t objectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::createObjectStore");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::createObjectStore");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -140,9 +140,9 @@ void IDBDatabaseBackendLevelDB::createObjectStore(int64_t transactionId, int64_t
     addObjectStore(objectStoreMetadata, objectStoreId);
 }
 
-void IDBDatabaseBackendLevelDB::deleteObjectStore(int64_t transactionId, int64_t objectStoreId)
+void IDBDatabaseBackendImpl::deleteObjectStore(int64_t transactionId, int64_t objectStoreId)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::deleteObjectStore");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::deleteObjectStore");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -155,9 +155,9 @@ void IDBDatabaseBackendLevelDB::deleteObjectStore(int64_t transactionId, int64_t
     removeObjectStore(objectStoreId);
 }
 
-void IDBDatabaseBackendLevelDB::createIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry)
+void IDBDatabaseBackendImpl::createIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::createIndex");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::createIndex");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -174,9 +174,9 @@ void IDBDatabaseBackendLevelDB::createIndex(int64_t transactionId, int64_t objec
     addIndex(objectStoreId, indexMetadata, indexId);
 }
 
-void IDBDatabaseBackendLevelDB::deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId)
+void IDBDatabaseBackendImpl::deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::deleteIndex");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::deleteIndex");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -193,30 +193,30 @@ void IDBDatabaseBackendLevelDB::deleteIndex(int64_t transactionId, int64_t objec
     removeIndex(objectStoreId, indexId);
 }
 
-void IDBDatabaseBackendLevelDB::commit(int64_t transactionId)
+void IDBDatabaseBackendImpl::commit(int64_t transactionId)
 {
     // The frontend suggests that we commit, but we may have previously initiated an abort, and so have disposed of the transaction. onAbort has already been dispatched to the frontend, so it will find out about that asynchronously.
     if (m_transactions.contains(transactionId))
         m_transactions.get(transactionId)->commit();
 }
 
-void IDBDatabaseBackendLevelDB::abort(int64_t transactionId)
+void IDBDatabaseBackendImpl::abort(int64_t transactionId)
 {
     // If the transaction is unknown, then it has already been aborted by the backend before this call so it is safe to ignore it.
     if (m_transactions.contains(transactionId))
         m_transactions.get(transactionId)->abort();
 }
 
-void IDBDatabaseBackendLevelDB::abort(int64_t transactionId, PassRefPtr<IDBDatabaseError> error)
+void IDBDatabaseBackendImpl::abort(int64_t transactionId, PassRefPtr<IDBDatabaseError> error)
 {
     // If the transaction is unknown, then it has already been aborted by the backend before this call so it is safe to ignore it.
     if (m_transactions.contains(transactionId))
         m_transactions.get(transactionId)->abort(error);
 }
 
-void IDBDatabaseBackendLevelDB::get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBCallbacks> callbacks)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::get");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::get");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -224,9 +224,9 @@ void IDBDatabaseBackendLevelDB::get(int64_t transactionId, int64_t objectStoreId
     transaction->scheduleGetOperation(m_metadata, objectStoreId, indexId, keyRange, keyOnly ? IndexedDB::CursorKeyOnly : IndexedDB::CursorKeyAndValue, callbacks);
 }
 
-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)
+void IDBDatabaseBackendImpl::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");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::put");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -239,9 +239,9 @@ void IDBDatabaseBackendLevelDB::put(int64_t transactionId, int64_t objectStoreId
     transaction->schedulePutOperation(objectStoreMetadata, value, key, putMode, callbacks, indexIds, indexKeys);
 }
 
-void IDBDatabaseBackendLevelDB::setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
+void IDBDatabaseBackendImpl::setIndexKeys(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKey> prpPrimaryKey, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::setIndexKeys");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::setIndexKeys");
     ASSERT(prpPrimaryKey);
 
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
@@ -285,9 +285,9 @@ void IDBDatabaseBackendLevelDB::setIndexKeys(int64_t transactionId, int64_t obje
     }
 }
 
-void IDBDatabaseBackendLevelDB::setIndexesReady(int64_t transactionId, int64_t, const Vector<int64_t>& indexIds)
+void IDBDatabaseBackendImpl::setIndexesReady(int64_t transactionId, int64_t, const Vector<int64_t>& indexIds)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::setIndexesReady");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::setIndexesReady");
 
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
@@ -296,9 +296,9 @@ void IDBDatabaseBackendLevelDB::setIndexesReady(int64_t transactionId, int64_t,
     transaction->scheduleSetIndexesReadyOperation(indexIds.size());
 }
 
-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)
+void IDBDatabaseBackendImpl::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");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::openCursor");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -306,9 +306,9 @@ void IDBDatabaseBackendLevelDB::openCursor(int64_t transactionId, int64_t object
     transaction->scheduleOpenCursorOperation(objectStoreId, indexId, keyRange, direction, keyOnly ? IndexedDB::CursorKeyOnly : IndexedDB::CursorKeyAndValue, taskType, callbacks);
 }
 
-void IDBDatabaseBackendLevelDB::count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::count");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::count");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -318,9 +318,9 @@ void IDBDatabaseBackendLevelDB::count(int64_t transactionId, int64_t objectStore
 }
 
 
-void IDBDatabaseBackendLevelDB::deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::deleteRange");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::deleteRange");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -329,9 +329,9 @@ void IDBDatabaseBackendLevelDB::deleteRange(int64_t transactionId, int64_t objec
     transaction->scheduleDeleteRangeOperation(objectStoreId, keyRange, callbacks);
 }
 
-void IDBDatabaseBackendLevelDB::clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
 {
-    LOG(StorageAPI, "IDBDatabaseBackendLevelDB::clear");
+    LOG(StorageAPI, "IDBDatabaseBackendImpl::clear");
     IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
     if (!transaction)
         return;
@@ -340,7 +340,7 @@ void IDBDatabaseBackendLevelDB::clear(int64_t transactionId, int64_t objectStore
     transaction->scheduleClearOperation(objectStoreId, callbacks);
 }
 
-void IDBDatabaseBackendLevelDB::transactionStarted(IDBTransactionBackendInterface* transaction)
+void IDBDatabaseBackendImpl::transactionStarted(IDBTransactionBackendInterface* transaction)
 {
     if (transaction->mode() == IndexedDB::TransactionVersionChange) {
         ASSERT(!m_runningVersionChangeTransaction);
@@ -348,7 +348,7 @@ void IDBDatabaseBackendLevelDB::transactionStarted(IDBTransactionBackendInterfac
     }
 }
 
-void IDBDatabaseBackendLevelDB::transactionFinished(IDBTransactionBackendInterface* rawTransaction)
+void IDBDatabaseBackendImpl::transactionFinished(IDBTransactionBackendInterface* rawTransaction)
 {
     RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
     ASSERT(m_transactions.contains(transaction->id()));
@@ -360,7 +360,7 @@ void IDBDatabaseBackendLevelDB::transactionFinished(IDBTransactionBackendInterfa
     }
 }
 
-void IDBDatabaseBackendLevelDB::transactionFinishedAndAbortFired(IDBTransactionBackendInterface* rawTransaction)
+void IDBDatabaseBackendImpl::transactionFinishedAndAbortFired(IDBTransactionBackendInterface* rawTransaction)
 {
     RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
     if (transaction->mode() == IndexedDB::TransactionVersionChange) {
@@ -375,20 +375,20 @@ void IDBDatabaseBackendLevelDB::transactionFinishedAndAbortFired(IDBTransactionB
     }
 }
 
-void IDBDatabaseBackendLevelDB::transactionFinishedAndCompleteFired(IDBTransactionBackendInterface* rawTransaction)
+void IDBDatabaseBackendImpl::transactionFinishedAndCompleteFired(IDBTransactionBackendInterface* rawTransaction)
 {
     RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
     if (transaction->mode() == IndexedDB::TransactionVersionChange)
         processPendingCalls();
 }
 
-size_t IDBDatabaseBackendLevelDB::connectionCount()
+size_t IDBDatabaseBackendImpl::connectionCount()
 {
     // This does not include pending open calls, as those should not block version changes and deletes.
     return m_databaseCallbacksSet.size();
 }
 
-void IDBDatabaseBackendLevelDB::processPendingCalls()
+void IDBDatabaseBackendImpl::processPendingCalls()
 {
     if (m_pendingSecondHalfOpen) {
         // FIXME: Database versions are now of type uint64_t, but this code expected int64_t.
@@ -427,15 +427,18 @@ void IDBDatabaseBackendLevelDB::processPendingCalls()
     }
 }
 
-void IDBDatabaseBackendLevelDB::createTransaction(int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, unsigned short mode)
+void IDBDatabaseBackendImpl::createTransaction(int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, unsigned short mode)
 {
-    RefPtr<IDBTransactionBackendInterface> transaction = m_factory->createTransactionBackend(this, transactionId, callbacks, objectStoreIds, static_cast<IndexedDB::TransactionMode>(mode));
+    RefPtr<IDBTransactionBackendInterface> transaction = m_factory->maybeCreateTransactionBackend(this, transactionId, callbacks, objectStoreIds, static_cast<IndexedDB::TransactionMode>(mode));
+
+    if (!transaction)
+        return;
 
     ASSERT(!m_transactions.contains(transactionId));
     m_transactions.add(transactionId, transaction.get());
 }
 
-void IDBDatabaseBackendLevelDB::openConnection(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallbacks> prpDatabaseCallbacks, int64_t transactionId, int64_t version)
+void IDBDatabaseBackendImpl::openConnection(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallbacks> prpDatabaseCallbacks, int64_t transactionId, int64_t version)
 {
     ASSERT(m_backingStore.get());
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
@@ -502,7 +505,7 @@ void IDBDatabaseBackendLevelDB::openConnection(PassRefPtr<IDBCallbacks> prpCallb
     callbacks->onSuccess(this, this->metadata());
 }
 
-void IDBDatabaseBackendLevelDB::runIntVersionChangeTransaction(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallbacks> prpDatabaseCallbacks, int64_t transactionId, int64_t requestedVersion)
+void IDBDatabaseBackendImpl::runIntVersionChangeTransaction(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<IDBDatabaseCallbacks> prpDatabaseCallbacks, int64_t transactionId, int64_t requestedVersion)
 {
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     RefPtr<IDBDatabaseCallbacks> databaseCallbacks = prpDatabaseCallbacks;
@@ -537,7 +540,7 @@ void IDBDatabaseBackendLevelDB::runIntVersionChangeTransaction(PassRefPtr<IDBCal
     m_databaseCallbacksSet.add(databaseCallbacks);
 }
 
-void IDBDatabaseBackendLevelDB::deleteDatabase(PassRefPtr<IDBCallbacks> prpCallbacks)
+void IDBDatabaseBackendImpl::deleteDatabase(PassRefPtr<IDBCallbacks> prpCallbacks)
 {
     RefPtr<IDBCallbacks> callbacks = prpCallbacks;
     if (isDeleteDatabaseBlocked()) {
@@ -555,12 +558,12 @@ void IDBDatabaseBackendLevelDB::deleteDatabase(PassRefPtr<IDBCallbacks> prpCallb
     deleteDatabaseFinal(callbacks.release());
 }
 
-bool IDBDatabaseBackendLevelDB::isDeleteDatabaseBlocked()
+bool IDBDatabaseBackendImpl::isDeleteDatabaseBlocked()
 {
     return connectionCount();
 }
 
-void IDBDatabaseBackendLevelDB::deleteDatabaseFinal(PassRefPtr<IDBCallbacks> callbacks)
+void IDBDatabaseBackendImpl::deleteDatabaseFinal(PassRefPtr<IDBCallbacks> callbacks)
 {
     ASSERT(!isDeleteDatabaseBlocked());
     ASSERT(m_backingStore);
@@ -574,7 +577,7 @@ void IDBDatabaseBackendLevelDB::deleteDatabaseFinal(PassRefPtr<IDBCallbacks> cal
     callbacks->onSuccess();
 }
 
-void IDBDatabaseBackendLevelDB::close(PassRefPtr<IDBDatabaseCallbacks> prpCallbacks)
+void IDBDatabaseBackendImpl::close(PassRefPtr<IDBDatabaseCallbacks> prpCallbacks)
 {
     RefPtr<IDBDatabaseCallbacks> callbacks = prpCallbacks;
     ASSERT(m_databaseCallbacksSet.contains(callbacks));
@@ -589,7 +592,7 @@ void IDBDatabaseBackendLevelDB::close(PassRefPtr<IDBDatabaseCallbacks> prpCallba
         return;
 
     // processPendingCalls allows the inspector to process a pending open call
-    // and call close, reentering IDBDatabaseBackendLevelDB::close. Then the
+    // and call close, reentering IDBDatabaseBackendImpl::close. Then the
     // backend would be removed both by the inspector closing its connection, and
     // by the connection that first called close.
     // To avoid that situation, don't proceed in case of reentrancy.
similarity index 93%
rename from Source/WebCore/Modules/indexeddb/leveldb/IDBDatabaseBackendLevelDB.h
rename to Source/WebCore/Modules/indexeddb/IDBDatabaseBackendImpl.h
index 69122c3aed2475fd235ace118d25eacc33793cc6..9e7363f87568203ddbab41598f6e66e03e67f4a6 100644 (file)
@@ -23,8 +23,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef IDBDatabaseBackendLevelDB_h
-#define IDBDatabaseBackendLevelDB_h
+#ifndef IDBDatabaseBackendImpl_h
+#define IDBDatabaseBackendImpl_h
 
 #include "IDBCallbacks.h"
 #include "IDBDatabaseCallbacks.h"
@@ -44,10 +44,10 @@ class IDBFactoryBackendInterface;
 class IDBTransactionBackendInterface;
 class IDBTransactionCoordinator;
 
-class IDBDatabaseBackendLevelDB : public IDBDatabaseBackendInterface {
+class IDBDatabaseBackendImpl FINAL : public IDBDatabaseBackendInterface {
 public:
-    static PassRefPtr<IDBDatabaseBackendLevelDB> create(const String& name, IDBBackingStoreInterface*, IDBFactoryBackendInterface*, const String& uniqueIdentifier);
-    virtual ~IDBDatabaseBackendLevelDB();
+    static PassRefPtr<IDBDatabaseBackendImpl> create(const String& name, IDBBackingStoreInterface*, IDBFactoryBackendInterface*, const String& uniqueIdentifier);
+    virtual ~IDBDatabaseBackendImpl();
 
     IDBBackingStoreInterface* backingStore() const;
 
@@ -90,11 +90,13 @@ public:
     virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) OVERRIDE;
     virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>) OVERRIDE;
 
+    virtual bool isIDBDatabaseBackendImpl() OVERRIDE { return true; }
+
     class VersionChangeOperation;
     class VersionChangeAbortOperation;
 
 private:
-    IDBDatabaseBackendLevelDB(const String& name, IDBBackingStoreInterface*, IDBFactoryBackendInterface*, const String& uniqueIdentifier);
+    IDBDatabaseBackendImpl(const String& name, IDBBackingStoreInterface*, IDBFactoryBackendInterface*, const String& uniqueIdentifier);
 
     bool openInternal();
     void runIntVersionChangeTransaction(PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, int64_t transactionId, int64_t requestedVersion);
@@ -173,4 +175,4 @@ private:
 
 #endif // ENABLE(INDEXED_DATABASE)
 
-#endif // IDBDatabaseBackendLevelDB_h
+#endif // IDBDatabaseBackendImpl_h
index 6d4ecadeb9caddf3a4a3d5e4c1aad04d0a5fd51d..1475da5d17137e93105eaa1286a0b0dd3ffe4b7e 100644 (file)
@@ -36,6 +36,7 @@
 
 namespace WebCore {
 
+class IDBBackingStoreInterface;
 class IDBCallbacks;
 class IDBDatabaseCallbacks;
 class IDBKey;
@@ -89,6 +90,8 @@ public:
     virtual void count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0;
     virtual void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>) = 0;
     virtual void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>) = 0;
+
+    virtual bool isIDBDatabaseBackendImpl() { return false; }
 };
 
 } // namespace WebCore
index 7922398069fd1043800eb7e574310e8fc83f8637..2f013d3cb9a4887c8d5c9206a1d3e5afebe44929 100644 (file)
@@ -41,7 +41,7 @@ namespace WebCore {
 class IDBBackingStoreInterface;
 class IDBCallbacks;
 class IDBDatabase;
-class IDBDatabaseBackendLevelDB; // FIXME: This is a LevelDB specific type for now. http://webkit.org/b/123027 will fix that.
+class IDBDatabaseBackendInterface;
 class IDBDatabaseCallbacks;
 class IDBTransactionBackendInterface;
 class SecurityOrigin;
@@ -64,7 +64,7 @@ public:
 
     virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) = 0;
 
-    virtual PassRefPtr<IDBTransactionBackendInterface> createTransactionBackend(IDBDatabaseBackendLevelDB*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode) = 0;
+    virtual PassRefPtr<IDBTransactionBackendInterface> maybeCreateTransactionBackend(IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode) = 0;
 };
 
 } // namespace WebCore
index 29a5980083b0f10ce761369780001fef1f3f2501..424577d8ec568fd536b6f9759e01277c088b5825 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "IDBBackingStoreLevelDB.h"
 #include "IDBCallbacks.h"
-#include "IDBDatabaseBackendLevelDB.h"
+#include "IDBDatabaseBackendImpl.h"
 #include "IDBDatabaseCallbacks.h"
 #include "IDBDatabaseError.h"
 #include "IDBDatabaseException.h"
index b2deea355ee1846f24c51812a28e5b2bd1432592..7f71346d231b49657bc6bc35ff037c71ccb87ec2 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "IDBBackingStoreLevelDB.h"
 #include "IDBCursorBackendInterface.h"
-#include "IDBDatabaseBackendLevelDB.h"
+#include "IDBDatabaseBackendImpl.h"
 #include "IDBTransactionBackendLevelDB.h"
 #include "SharedBuffer.h"
 #include <wtf/OwnPtr.h>
@@ -76,7 +76,7 @@ private:
 
     IDBDatabaseBackendInterface::TaskType m_taskType;
     IndexedDB::CursorType m_cursorType;
-    const RefPtr<IDBDatabaseBackendLevelDB> m_database;
+    const RefPtr<IDBDatabaseBackendImpl> m_database;
     RefPtr<IDBTransactionBackendLevelDB> m_transaction;
     const int64_t m_objectStoreId;
 
index 04e4c1ba11d5f73c73f3e9067ba8426d8d66c168..864961d28edfba02bd5ed8477dc5958f22387910 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "DOMStringList.h"
 #include "IDBBackingStoreLevelDB.h"
-#include "IDBDatabaseBackendLevelDB.h"
+#include "IDBDatabaseBackendImpl.h"
 #include "IDBDatabaseException.h"
 #include "IDBTransactionBackendLevelDB.h"
 #include "IDBTransactionCoordinator.h"
@@ -119,7 +119,7 @@ void IDBFactoryBackendLevelDB::deleteDatabase(const String& name, PassRefPtr<IDB
         return;
     }
 
-    RefPtr<IDBDatabaseBackendLevelDB> databaseBackend = IDBDatabaseBackendLevelDB::create(name, backingStore.get(), this, uniqueIdentifier);
+    RefPtr<IDBDatabaseBackendImpl> databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get(), this, uniqueIdentifier);
     if (databaseBackend) {
         m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get());
         databaseBackend->deleteDatabase(callbacks);
@@ -165,7 +165,7 @@ void IDBFactoryBackendLevelDB::open(const String& name, int64_t version, int64_t
     RefPtr<SecurityOrigin> securityOrigin = prpSecurityOrigin;
     const String uniqueIdentifier = computeUniqueIdentifier(name, securityOrigin.get());
 
-    RefPtr<IDBDatabaseBackendLevelDB> databaseBackend;
+    RefPtr<IDBDatabaseBackendImpl> databaseBackend;
     IDBDatabaseBackendMap::iterator it = m_databaseBackendMap.find(uniqueIdentifier);
     if (it == m_databaseBackendMap.end()) {
         RefPtr<IDBBackingStoreLevelDB> backingStore = openBackingStore(securityOrigin, dataDirectory);
@@ -174,7 +174,7 @@ void IDBFactoryBackendLevelDB::open(const String& name, int64_t version, int64_t
             return;
         }
 
-        databaseBackend = IDBDatabaseBackendLevelDB::create(name, backingStore.get(), this, uniqueIdentifier);
+        databaseBackend = IDBDatabaseBackendImpl::create(name, backingStore.get(), this, uniqueIdentifier);
         if (databaseBackend)
             m_databaseBackendMap.set(uniqueIdentifier, databaseBackend.get());
         else {
@@ -187,9 +187,12 @@ void IDBFactoryBackendLevelDB::open(const String& name, int64_t version, int64_t
     databaseBackend->openConnection(callbacks, databaseCallbacks, transactionId, version);
 }
 
-PassRefPtr<IDBTransactionBackendInterface> IDBFactoryBackendLevelDB::createTransactionBackend(IDBDatabaseBackendLevelDB* backend, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
+PassRefPtr<IDBTransactionBackendInterface> IDBFactoryBackendLevelDB::maybeCreateTransactionBackend(IDBDatabaseBackendInterface* backend, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
 {
-    return IDBTransactionBackendLevelDB::create(backend, transactionId, databaseCallbacks, objectStoreIds, mode);
+    if (!backend->isIDBDatabaseBackendImpl())
+        return 0;
+
+    return IDBTransactionBackendLevelDB::create(static_cast<IDBDatabaseBackendImpl*>(backend), transactionId, databaseCallbacks, objectStoreIds, mode);
 }
 
 } // namespace WebCore
index 7a330a32327818b182a152118ca8d1bb74b551ff..03caada23f34872548096004123fde609ca518b7 100644 (file)
@@ -45,7 +45,7 @@ namespace WebCore {
 class DOMStringList;
 
 class IDBBackingStoreLevelDB;
-class IDBDatabaseBackendLevelDB;
+class IDBDatabaseBackendImpl;
 
 class IDBFactoryBackendLevelDB : public IDBFactoryBackendInterface {
 public:
@@ -63,7 +63,7 @@ public:
 
     virtual void deleteDatabase(const String& name, PassRefPtr<IDBCallbacks>, PassRefPtr<SecurityOrigin>, ScriptExecutionContext*, const String& dataDir) OVERRIDE FINAL;
 
-    virtual PassRefPtr<IDBTransactionBackendInterface> createTransactionBackend(IDBDatabaseBackendLevelDB*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, IndexedDB::TransactionMode) OVERRIDE FINAL;
+    virtual PassRefPtr<IDBTransactionBackendInterface> maybeCreateTransactionBackend(IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, IndexedDB::TransactionMode) OVERRIDE FINAL;
 
 
 protected:
@@ -71,7 +71,7 @@ protected:
     virtual PassRefPtr<IDBBackingStoreLevelDB> openBackingStore(PassRefPtr<SecurityOrigin>, const String& dataDir);
 
 private:
-    typedef HashMap<String, RefPtr<IDBDatabaseBackendLevelDB> > IDBDatabaseBackendMap;
+    typedef HashMap<String, RefPtr<IDBDatabaseBackendImpl> > IDBDatabaseBackendMap;
     IDBDatabaseBackendMap m_databaseBackendMap;
 
     typedef HashMap<String, WeakPtr<IDBBackingStoreLevelDB> > IDBBackingStoreLevelDBMap;
index 46379c56662270798f29be67a7c4521db0e0a302..560d19f9865a6dbf5df3897c83157583f027c125 100644 (file)
@@ -1521,7 +1521,7 @@ int64_t IndexFreeListKey::indexId() const
 }
 
 // FIXME: We never use this to look up object store ids, because a mapping
-// is kept in the IDBDatabaseBackendLevelDB. Can the mapping become unreliable?
+// is kept in the IDBDatabaseBackendImpl. Can the mapping become unreliable?
 // Can we remove this?
 const char* ObjectStoreNamesKey::decode(const char* start, const char* limit, ObjectStoreNamesKey* result)
 {
index ad22f11eb0cfd79a9983c60d80f4b864c82d24a4..278d0f8131946869f0f54b9df2255f11e9445c4f 100644 (file)
@@ -281,7 +281,7 @@ private:
 class ObjectStoreNamesKey {
 public:
     // FIXME: We never use this to look up object store ids, because a mapping
-    // is kept in the IDBDatabaseBackendLevelDB. Can the mapping become unreliable?
+    // is kept in the IDBDatabaseBackendImpl. Can the mapping become unreliable?
     // Can we remove this?
     static const char* decode(const char* start, const char* limit, ObjectStoreNamesKey* result);
     static Vector<char> encode(int64_t databaseId, const String& objectStoreName);
index 1ba9cbbcc5aabf5079411d9328f7dd31577ed51f..9aa257e39bbceb210cc04383c04720e3053be0b7 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "IDBBackingStoreLevelDB.h"
 #include "IDBCursorBackendLevelDB.h"
-#include "IDBDatabaseBackendLevelDB.h"
+#include "IDBDatabaseBackendImpl.h"
 #include "IDBDatabaseCallbacks.h"
 #include "IDBDatabaseException.h"
 #include "IDBKeyRange.h"
@@ -40,7 +40,7 @@
 
 namespace WebCore {
 
-PassRefPtr<IDBTransactionBackendLevelDB> IDBTransactionBackendLevelDB::create(IDBDatabaseBackendLevelDB* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
+PassRefPtr<IDBTransactionBackendLevelDB> IDBTransactionBackendLevelDB::create(IDBDatabaseBackendImpl* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
 {
     HashSet<int64_t> objectStoreHashSet;
     for (size_t i = 0; i < objectStoreIds.size(); ++i)
@@ -49,7 +49,7 @@ PassRefPtr<IDBTransactionBackendLevelDB> IDBTransactionBackendLevelDB::create(ID
     return adoptRef(new IDBTransactionBackendLevelDB(databaseBackend, id, callbacks, objectStoreHashSet, mode));
 }
 
-IDBTransactionBackendLevelDB::IDBTransactionBackendLevelDB(IDBDatabaseBackendLevelDB* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const HashSet<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
+IDBTransactionBackendLevelDB::IDBTransactionBackendLevelDB(IDBDatabaseBackendImpl* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const HashSet<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
     : IDBTransactionBackendInterface(id)
     , m_objectStoreIds(objectStoreIds)
     , m_mode(mode)
@@ -282,7 +282,7 @@ void IDBTransactionBackendLevelDB::scheduleDeleteObjectStoreOperation(const IDBO
 
 void IDBTransactionBackendLevelDB::scheduleVersionChangeOperation(int64_t transactionId, int64_t requestedVersion, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const IDBDatabaseMetadata& metadata)
 {
-    scheduleTask(IDBDatabaseBackendLevelDB::VersionChangeOperation::create(this, transactionId, requestedVersion, callbacks, databaseCallbacks), IDBDatabaseBackendLevelDB::VersionChangeAbortOperation::create(this, String::number(metadata.version), metadata.version));
+    scheduleTask(IDBDatabaseBackendImpl::VersionChangeOperation::create(this, transactionId, requestedVersion, callbacks, databaseCallbacks), IDBDatabaseBackendImpl::VersionChangeAbortOperation::create(this, String::number(metadata.version), metadata.version));
 }
 
 void IDBTransactionBackendLevelDB::scheduleCreateIndexOperation(int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
index 5e659eaaf49581b7f38db2207491a2d628d13676..02460a319781ef1f47c0bbef47b9d26bcee80254 100644 (file)
@@ -29,8 +29,8 @@
 #if ENABLE(INDEXED_DATABASE) && USE(LEVELDB)
 
 #include "IDBBackingStoreLevelDB.h"
+#include "IDBDatabaseBackendImpl.h"
 #include "IDBDatabaseBackendInterface.h"
-#include "IDBDatabaseBackendLevelDB.h"
 #include "IDBDatabaseError.h"
 #include "IDBTransactionBackendInterface.h"
 #include "Timer.h"
@@ -46,7 +46,7 @@ class IDBDatabaseCallbacks;
 
 class IDBTransactionBackendLevelDB FINAL : public IDBTransactionBackendInterface {
 public:
-    static PassRefPtr<IDBTransactionBackendLevelDB> create(IDBDatabaseBackendLevelDB*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode);
+    static PassRefPtr<IDBTransactionBackendLevelDB> create(IDBDatabaseBackendImpl*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode);
     virtual ~IDBTransactionBackendLevelDB();
 
     virtual void commit() OVERRIDE FINAL;
@@ -70,7 +70,7 @@ public:
     void didCompletePreemptiveEvent() { m_pendingPreemptiveEvents--; ASSERT(m_pendingPreemptiveEvents >= 0); }
     virtual IDBBackingStoreInterface::Transaction* backingStoreTransaction() { return &m_transaction; }
 
-    IDBDatabaseBackendLevelDB* database() const { return m_database.get(); }
+    IDBDatabaseBackendImpl* database() const { return m_database.get(); }
 
     virtual void scheduleCreateObjectStoreOperation(const IDBObjectStoreMetadata&) OVERRIDE FINAL;
     virtual void scheduleDeleteObjectStoreOperation(const IDBObjectStoreMetadata&) OVERRIDE FINAL;
@@ -86,7 +86,7 @@ public:
     virtual void scheduleClearOperation(int64_t objectStoreId, PassRefPtr<IDBCallbacks>) OVERRIDE FINAL;
     
 private:
-    IDBTransactionBackendLevelDB(IDBDatabaseBackendLevelDB*, int64_t id, PassRefPtr<IDBDatabaseCallbacks>, const HashSet<int64_t>& objectStoreIds, IndexedDB::TransactionMode);
+    IDBTransactionBackendLevelDB(IDBDatabaseBackendImpl*, int64_t id, PassRefPtr<IDBDatabaseCallbacks>, const HashSet<int64_t>& objectStoreIds, IndexedDB::TransactionMode);
 
     enum State {
         Unused, // Created, but no tasks yet.
@@ -109,7 +109,7 @@ private:
     State m_state;
     bool m_commitPending;
     RefPtr<IDBDatabaseCallbacks> m_callbacks;
-    RefPtr<IDBDatabaseBackendLevelDB> m_database;
+    RefPtr<IDBDatabaseBackendImpl> m_database;
 
     typedef Deque<OwnPtr<Operation>> TaskQueue;
     TaskQueue m_taskQueue;
index deeb6270a633afe0021a9616c81b2b9858d8472c..dad6505c1f9f72dff80451135e7c2d463236f809 100644 (file)
@@ -340,10 +340,10 @@ void DeleteObjectStoreOperation::perform()
     }
 }
 
-void IDBDatabaseBackendLevelDB::VersionChangeOperation::perform()
+void IDBDatabaseBackendImpl::VersionChangeOperation::perform()
 {
     LOG(StorageAPI, "VersionChangeOperation");
-    IDBDatabaseBackendLevelDB* database = m_transaction->database();
+    IDBDatabaseBackendImpl* database = m_transaction->database();
     int64_t databaseId = database->id();
     uint64_t oldVersion = database->m_metadata.version;
 
@@ -373,7 +373,7 @@ void DeleteObjectStoreAbortOperation::perform()
     m_transaction->database()->addObjectStore(m_objectStoreMetadata, IDBObjectStoreMetadata::InvalidId);
 }
 
-void IDBDatabaseBackendLevelDB::VersionChangeAbortOperation::perform()
+void IDBDatabaseBackendImpl::VersionChangeAbortOperation::perform()
 {
     LOG(StorageAPI, "VersionChangeAbortOperation");
     m_transaction->database()->m_metadata.version = m_previousIntVersion;
index bcf72fd2bfa07ee9609d6cd3d0be8b62bb156cbf..c9d89c1c578186826d8a561f3aabfa7abaddf4c6 100644 (file)
@@ -72,7 +72,7 @@ private:
     const IDBObjectStoreMetadata m_objectStoreMetadata;
 };
 
-class IDBDatabaseBackendLevelDB::VersionChangeOperation : public IDBTransactionBackendLevelDB::Operation {
+class IDBDatabaseBackendImpl::VersionChangeOperation : public IDBTransactionBackendLevelDB::Operation {
 public:
     static PassOwnPtr<IDBTransactionBackendLevelDB::Operation> create(IDBTransactionBackendLevelDB* transaction, int64_t transactionId, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
     {
@@ -132,7 +132,7 @@ private:
     IDBObjectStoreMetadata m_objectStoreMetadata;
 };
 
-class IDBDatabaseBackendLevelDB::VersionChangeAbortOperation : public IDBTransactionBackendLevelDB::Operation {
+class IDBDatabaseBackendImpl::VersionChangeAbortOperation : public IDBTransactionBackendLevelDB::Operation {
 public:
     static PassOwnPtr<IDBTransactionBackendLevelDB::Operation> create(IDBTransactionBackendLevelDB* transaction, const String& previousVersion, int64_t previousIntVersion)
     {
index ce436a74110c6ff5149d054723398fca878952d5..d5f066996102e250accbe18577d47fd530fd582c 100644 (file)
     <ClCompile Include="..\Modules\indexeddb\IDBCursor.cpp" />
     <ClCompile Include="..\Modules\indexeddb\leveldb\IDBCursorBackendLevelDB.cpp" />
     <ClCompile Include="..\Modules\indexeddb\IDBDatabase.cpp" />
-    <ClCompile Include="..\Modules\indexeddb\leveldb\IDBDatabaseBackendLevelDB.cpp" />
     <ClCompile Include="..\Modules\indexeddb\IDBFactory.cpp" />
     <ClCompile Include="..\Modules\indexeddb\leveldb\IDBFactoryBackendLevelDB.cpp" />
     <ClCompile Include="..\Modules\indexeddb\IDBFactoryBackendInterface.cpp" />
index 812749eb7069b3c8409c7278a4b28399122026dd..48b35094eb855a07ad97336ff75c76e58a24016f 100644 (file)
     <ClCompile Include="..\Modules\indexeddb\leveldb\IDBCursorBackendLevelDB.cpp">
       <Filter>Modules\indexeddb\leveldb</Filter>
     </ClCompile>
-    <ClCompile Include="..\Modules\indexeddb\leveldb\IDBDatabaseBackendLevelDB.cpp">
-      <Filter>Modules\indexeddb\leveldb</Filter>
-    </ClCompile>
     <ClCompile Include="..\Modules\indexeddb\leveldb\IDBFactoryBackendLevelDB.cpp">
       <Filter>Modules\indexeddb\leveldb</Filter>
     </ClCompile>
index 8346e142ea95ec27ffbbf6a709095bd01cf9e9bf..18b9090feb521dc1bc24c063fc63215f75af3942 100644 (file)
                510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */; };
                510EC42A18170C7500C897D6 /* IDBIndexWriter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510EC42818170C7500C897D6 /* IDBIndexWriter.cpp */; };
                510EC42B18170C7500C897D6 /* IDBIndexWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 510EC42918170C7500C897D6 /* IDBIndexWriter.h */; };
+               510EC44F181779D500C897D6 /* IDBDatabaseBackendImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510EC44D181779D500C897D6 /* IDBDatabaseBackendImpl.cpp */; };
+               510EC450181779D500C897D6 /* IDBDatabaseBackendImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = 510EC44E181779D500C897D6 /* IDBDatabaseBackendImpl.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5112935F3D54B4B52FAF973F /* InspectorHeapProfilerAgent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511293613D6DB4B52FAF973F /* InspectorHeapProfilerAgent.cpp */; };
                511293603D60B4B52FAF973F /* InspectorHeapProfilerAgent.h in Headers */ = {isa = PBXBuildFile; fileRef = 511293623D85B4B52FAF973F /* InspectorHeapProfilerAgent.h */; };
                511EF2C017F0FD3500E4FA16 /* JSIDBAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EF2A817F0FC4800E4FA16 /* JSIDBAny.cpp */; };
                510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleClient.h; sourceTree = "<group>"; };
                510EC42818170C7500C897D6 /* IDBIndexWriter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBIndexWriter.cpp; sourceTree = "<group>"; };
                510EC42918170C7500C897D6 /* IDBIndexWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBIndexWriter.h; sourceTree = "<group>"; };
+               510EC44D181779D500C897D6 /* IDBDatabaseBackendImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBDatabaseBackendImpl.cpp; sourceTree = "<group>"; };
+               510EC44E181779D500C897D6 /* IDBDatabaseBackendImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBDatabaseBackendImpl.h; sourceTree = "<group>"; };
                511293613D6DB4B52FAF973F /* InspectorHeapProfilerAgent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InspectorHeapProfilerAgent.cpp; sourceTree = "<group>"; };
                511293623D85B4B52FAF973F /* InspectorHeapProfilerAgent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectorHeapProfilerAgent.h; sourceTree = "<group>"; };
                511EF2A817F0FC4800E4FA16 /* JSIDBAny.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAny.cpp; sourceTree = "<group>"; };
                                51D7197C181106DF0016DC51 /* IDBDatabase.cpp */,
                                51D7197D181106DF0016DC51 /* IDBDatabase.h */,
                                51D7197E181106DF0016DC51 /* IDBDatabase.idl */,
+                               510EC44D181779D500C897D6 /* IDBDatabaseBackendImpl.cpp */,
+                               510EC44E181779D500C897D6 /* IDBDatabaseBackendImpl.h */,
                                51D7197F181106DF0016DC51 /* IDBDatabaseBackendInterface.h */,
                                51D71980181106DF0016DC51 /* IDBDatabaseCallbacks.h */,
                                51D71981181106DF0016DC51 /* IDBDatabaseCallbacksImpl.cpp */,
                                935C476309AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h in Headers */,
                                85031B480A44EFC700F992E0 /* MouseRelatedEvent.h in Headers */,
                                93309DFC099E64920056E581 /* MoveSelectionCommand.h in Headers */,
+                               510EC450181779D500C897D6 /* IDBDatabaseBackendImpl.h in Headers */,
                                FDB1700614A2BAB200A2B5D9 /* MultiChannelResampler.h in Headers */,
                                C6F0900A14327B6100685849 /* MutationCallback.h in Headers */,
                                85031B4A0A44EFC700F992E0 /* MutationEvent.h in Headers */,
                                078E091117D14CEE00420AA1 /* RTCVoidRequestImpl.cpp in Sources */,
                                498391580F1E776900C23782 /* WebKitCSSMatrix.cpp in Sources */,
                                A24BF77C15CC3BAF003191F2 /* WebKitCSSMixFunctionValue.cpp in Sources */,
+                               510EC44F181779D500C897D6 /* IDBDatabaseBackendImpl.cpp in Sources */,
                                8AA61CFF144D595B00F37350 /* WebKitCSSRegionRule.cpp in Sources */,
                                5038BC0714711CDB0095E0D1 /* WebKitCSSShaderValue.cpp in Sources */,
                                0562F9461573ECEB0031CA16 /* WebKitCSSSVGDocumentValue.cpp in Sources */,
index 731716dabdb624182cb81079cc0a80de97c58788..afb5b80e581a55af91f4f4cbcb89675d9c597236 100644 (file)
@@ -1,3 +1,14 @@
+2013-10-23  Brady Eidson  <beidson@apple.com>
+
+        Make IDBDatabaseBackendLevelDB.cpp be cross platform
+        https://bugs.webkit.org/show_bug.cgi?id=123027
+
+        Attentively reviewed by Dean Jackson.
+
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
+        (WebKit::WebIDBFactoryBackend::maybeCreateTransactionBackend):
+        * WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:
+
 2013-10-23  Dan Bernstein  <mitz@apple.com>
 
         Fixed a typo.
index 137caccb85af9649e7fc4cb2cd6b888529bf8882..a3e8ee26c281b45b5f18ea4fb2b613456851a480 100644 (file)
@@ -100,7 +100,7 @@ void WebIDBFactoryBackend::removeIDBDatabaseBackend(const String&)
     notImplemented();
 }
 
-PassRefPtr<IDBTransactionBackendInterface> WebIDBFactoryBackend::createTransactionBackend(IDBDatabaseBackendLevelDB*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, IndexedDB::TransactionMode)
+PassRefPtr<IDBTransactionBackendInterface> WebIDBFactoryBackend::maybeCreateTransactionBackend(IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>&, IndexedDB::TransactionMode)
 {
     notImplemented();
     return 0;
index 7e252c80e74b7cd0da936e94f7670f05c39f5370..dd504617054343b4ca2de22b0e726cd547bad9bd 100644 (file)
@@ -45,7 +45,7 @@ public:
 
     virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) OVERRIDE FINAL;
 
-    virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> createTransactionBackend(WebCore::IDBDatabaseBackendLevelDB*, int64_t transactionId, PassRefPtr<WebCore::IDBDatabaseCallbacks>, const Vector<int64_t>&, WebCore::IndexedDB::TransactionMode);
+    virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> maybeCreateTransactionBackend(WebCore::IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<WebCore::IDBDatabaseCallbacks>, const Vector<int64_t>&, WebCore::IndexedDB::TransactionMode);
 
 private:
     WebIDBFactoryBackend();