Commit 37036791 authored by beidson@apple.com's avatar beidson@apple.com

Merge IDBTransactionBackendInterface and IDBTransactionBackendImpl

https://bugs.webkit.org/show_bug.cgi?id=124077

Reviewed by Alexey Proskuryakov.

Source/WebCore:

The abstraction is no longer needed.

* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:

* Modules/indexeddb/IDBTransactionBackendInterface.h: Removed.

* Modules/indexeddb/IDBTransactionBackend.cpp: Renamed from Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp.
* Modules/indexeddb/IDBTransactionBackend.h: Renamed from Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h.

* Modules/indexeddb/IDBBackingStoreInterface.h:
* Modules/indexeddb/IDBCursorBackend.cpp:
* Modules/indexeddb/IDBCursorBackend.h:
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
* Modules/indexeddb/IDBDatabaseBackendImpl.h:
* Modules/indexeddb/IDBFactoryBackendInterface.h:
* Modules/indexeddb/IDBTransactionBackendOperations.h:
* Modules/indexeddb/IDBTransactionCoordinator.cpp:
* Modules/indexeddb/IDBTransactionCoordinator.h:
* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp:
* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:

Source/WebKit2:

* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.cpp:
* WebProcess/Databases/IndexedDB/WebIDBFactoryBackend.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@158969 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f760ec12
......@@ -780,7 +780,7 @@ set(WebCore_SOURCES
Modules/indexeddb/IDBPendingTransactionMonitor.cpp
Modules/indexeddb/IDBRequest.cpp
Modules/indexeddb/IDBTransaction.cpp
Modules/indexeddb/IDBTransactionBackendImpl.cpp
Modules/indexeddb/IDBTransactionBackend.cpp
Modules/indexeddb/IDBTransactionBackendOperations.cpp
Modules/indexeddb/IDBTransactionCoordinator.cpp
Modules/indexeddb/IDBVersionChangeEvent.cpp
......
2013-11-08 Brady Eidson <beidson@apple.com>
Merge IDBTransactionBackendInterface and IDBTransactionBackendImpl
https://bugs.webkit.org/show_bug.cgi?id=124077
Reviewed by Alexey Proskuryakov.
The abstraction is no longer needed.
* CMakeLists.txt:
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:
* Modules/indexeddb/IDBTransactionBackendInterface.h: Removed.
* Modules/indexeddb/IDBTransactionBackend.cpp: Renamed from Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp.
* Modules/indexeddb/IDBTransactionBackend.h: Renamed from Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h.
* Modules/indexeddb/IDBBackingStoreInterface.h:
* Modules/indexeddb/IDBCursorBackend.cpp:
* Modules/indexeddb/IDBCursorBackend.h:
* Modules/indexeddb/IDBDatabaseBackendImpl.cpp:
* Modules/indexeddb/IDBDatabaseBackendImpl.h:
* Modules/indexeddb/IDBFactoryBackendInterface.h:
* Modules/indexeddb/IDBTransactionBackendOperations.h:
* Modules/indexeddb/IDBTransactionCoordinator.cpp:
* Modules/indexeddb/IDBTransactionCoordinator.h:
* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.cpp:
* Modules/indexeddb/leveldb/IDBBackingStoreLevelDB.h:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.cpp:
* Modules/indexeddb/leveldb/IDBFactoryBackendLevelDB.h:
2013-11-08 Simon Fraser <simon.fraser@apple.com>
REGRESSION (r155660): Some Etherpad pages not scrollable with overlay scrollbars
......
......@@ -1847,9 +1847,8 @@ webcore_modules_sources += \
Source/WebCore/Modules/indexeddb/IDBRequest.h \
Source/WebCore/Modules/indexeddb/IDBTransaction.cpp \
Source/WebCore/Modules/indexeddb/IDBTransaction.h \
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.cpp \
Source/WebCore/Modules/indexeddb/IDBTransactionBackendImpl.h \
Source/WebCore/Modules/indexeddb/IDBTransactionBackendInterface.h \
Source/WebCore/Modules/indexeddb/IDBTransactionBackend.cpp \
Source/WebCore/Modules/indexeddb/IDBTransactionBackend.h \
Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.cpp \
Source/WebCore/Modules/indexeddb/IDBTransactionBackendOperations.h \
Source/WebCore/Modules/indexeddb/IDBTransactionCoordinator.cpp \
......
......@@ -46,7 +46,7 @@ class IDBKey;
class IDBKeyPath;
class IDBKeyRange;
class IDBRecordIdentifier;
class IDBTransactionBackendInterface;
class IDBTransactionBackend;
class SharedBuffer;
class IDBBackingStoreInterface : public RefCounted<IDBBackingStoreInterface> {
......@@ -91,10 +91,10 @@ public:
virtual bool getKeyGeneratorCurrentNumber(IDBBackingStoreTransactionInterface&, int64_t databaseId, int64_t objectStoreId, int64_t& keyGeneratorCurrentNumber) = 0;
virtual bool maybeUpdateKeyGeneratorCurrentNumber(IDBBackingStoreTransactionInterface&, int64_t databaseId, int64_t objectStoreId, int64_t newState, bool checkCurrent) = 0;
virtual bool makeIndexWriters(IDBTransactionBackendInterface&, int64_t databaseId, const IDBObjectStoreMetadata&, IDBKey& primaryKey, bool keyWasGenerated, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&, Vector<RefPtr<IDBIndexWriter>>& indexWriters, String* errorMessage, bool& completed) = 0;
virtual bool makeIndexWriters(IDBTransactionBackend&, int64_t databaseId, const IDBObjectStoreMetadata&, IDBKey& primaryKey, bool keyWasGenerated, const Vector<int64_t>& indexIds, const Vector<IndexKeys>&, Vector<RefPtr<IDBIndexWriter>>& indexWriters, String* errorMessage, bool& completed) = 0;
virtual PassRefPtr<IDBKey> generateKey(IDBTransactionBackendInterface&, int64_t databaseId, int64_t objectStoreId) = 0;
virtual bool updateKeyGenerator(IDBTransactionBackendInterface&, int64_t databaseId, int64_t objectStoreId, const IDBKey&, bool checkCurrent) = 0;
virtual PassRefPtr<IDBKey> generateKey(IDBTransactionBackend&, int64_t databaseId, int64_t objectStoreId) = 0;
virtual bool updateKeyGenerator(IDBTransactionBackend&, int64_t databaseId, int64_t objectStoreId, const IDBKey&, bool checkCurrent) = 0;
};
......
......@@ -101,7 +101,7 @@ private:
RefPtr<IDBCallbacks> m_callbacks;
};
IDBCursorBackend::IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId)
IDBCursorBackend::IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackend* transaction, int64_t objectStoreId)
: m_taskType(taskType)
, m_cursorType(cursorType)
, m_database(&(transaction->database()))
......
......@@ -31,7 +31,7 @@
#include "IDBBackingStoreInterface.h"
#include "IDBDatabaseBackendImpl.h"
#include "IDBTransactionBackendImpl.h"
#include "IDBTransactionBackend.h"
#include "SharedBuffer.h"
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
......@@ -43,11 +43,11 @@ class IDBKeyRange;
class IDBCursorBackend : public RefCounted<IDBCursorBackend> {
public:
static PassRefPtr<IDBCursorBackend> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId)
static PassRefPtr<IDBCursorBackend> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBTransactionBackend* transaction, int64_t objectStoreId)
{
return adoptRef(new IDBCursorBackend(cursor, cursorType, IDBDatabaseBackendInterface::NormalTask, transaction, objectStoreId));
}
static PassRefPtr<IDBCursorBackend> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackendInterface* transaction, int64_t objectStoreId)
static PassRefPtr<IDBCursorBackend> create(PassRefPtr<IDBBackingStoreCursorInterface> cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, IDBTransactionBackend* transaction, int64_t objectStoreId)
{
return adoptRef(new IDBCursorBackend(cursor, cursorType, taskType, transaction, objectStoreId));
}
......@@ -67,7 +67,7 @@ public:
void close();
private:
IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface>, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, IDBTransactionBackendInterface*, int64_t objectStoreId);
IDBCursorBackend(PassRefPtr<IDBBackingStoreCursorInterface>, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, IDBTransactionBackend*, int64_t objectStoreId);
class CursorIterationOperation;
class CursorAdvanceOperation;
......@@ -76,7 +76,7 @@ private:
IDBDatabaseBackendInterface::TaskType m_taskType;
IndexedDB::CursorType m_cursorType;
const RefPtr<IDBDatabaseBackendInterface> m_database;
RefPtr<IDBTransactionBackendInterface> m_transaction;
RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_objectStoreId;
RefPtr<IDBBackingStoreCursorInterface> m_cursor; // Must be destroyed before m_transaction.
......
......@@ -36,7 +36,7 @@
#include "IDBIndexWriter.h"
#include "IDBKeyRange.h"
#include "IDBRecordIdentifier.h"
#include "IDBTransactionBackendInterface.h"
#include "IDBTransactionBackend.h"
#include "IDBTransactionCoordinator.h"
#include "Logging.h"
#include "SharedBuffer.h"
......@@ -135,7 +135,7 @@ IDBBackingStoreInterface* IDBDatabaseBackendImpl::backingStore() const
void IDBDatabaseBackendImpl::createObjectStore(int64_t transactionId, int64_t objectStoreId, const String& name, const IDBKeyPath& keyPath, bool autoIncrement)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::createObjectStore");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
......@@ -150,7 +150,7 @@ void IDBDatabaseBackendImpl::createObjectStore(int64_t transactionId, int64_t ob
void IDBDatabaseBackendImpl::deleteObjectStore(int64_t transactionId, int64_t objectStoreId)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::deleteObjectStore");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
......@@ -165,7 +165,7 @@ void IDBDatabaseBackendImpl::deleteObjectStore(int64_t transactionId, int64_t ob
void IDBDatabaseBackendImpl::createIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::createIndex");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
......@@ -184,7 +184,7 @@ void IDBDatabaseBackendImpl::createIndex(int64_t transactionId, int64_t objectSt
void IDBDatabaseBackendImpl::deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::deleteIndex");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
......@@ -224,7 +224,7 @@ void IDBDatabaseBackendImpl::abort(int64_t transactionId, PassRefPtr<IDBDatabase
void IDBDatabaseBackendImpl::get(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, bool keyOnly, PassRefPtr<IDBCallbacks> callbacks)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::get");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
......@@ -234,7 +234,7 @@ void IDBDatabaseBackendImpl::get(int64_t transactionId, int64_t objectStoreId, i
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, "IDBDatabaseBackendImpl::put");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() != IndexedDB::TransactionReadOnly);
......@@ -251,7 +251,7 @@ void IDBDatabaseBackendImpl::setIndexKeys(int64_t transactionId, int64_t objectS
LOG(StorageAPI, "IDBDatabaseBackendImpl::setIndexKeys");
ASSERT(prpPrimaryKey);
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() == IndexedDB::TransactionVersionChange);
......@@ -296,7 +296,7 @@ void IDBDatabaseBackendImpl::setIndexesReady(int64_t transactionId, int64_t, con
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::setIndexesReady");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
......@@ -306,7 +306,7 @@ void IDBDatabaseBackendImpl::setIndexesReady(int64_t transactionId, int64_t, con
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, "IDBDatabaseBackendImpl::openCursor");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
......@@ -316,7 +316,7 @@ void IDBDatabaseBackendImpl::openCursor(int64_t transactionId, int64_t objectSto
void IDBDatabaseBackendImpl::count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::count");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
......@@ -328,7 +328,7 @@ void IDBDatabaseBackendImpl::count(int64_t transactionId, int64_t objectStoreId,
void IDBDatabaseBackendImpl::deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::deleteRange");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() != IndexedDB::TransactionReadOnly);
......@@ -339,7 +339,7 @@ void IDBDatabaseBackendImpl::deleteRange(int64_t transactionId, int64_t objectSt
void IDBDatabaseBackendImpl::clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
{
LOG(StorageAPI, "IDBDatabaseBackendImpl::clear");
IDBTransactionBackendInterface* transaction = m_transactions.get(transactionId);
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
if (!transaction)
return;
ASSERT(transaction->mode() != IndexedDB::TransactionReadOnly);
......@@ -347,7 +347,7 @@ void IDBDatabaseBackendImpl::clear(int64_t transactionId, int64_t objectStoreId,
transaction->scheduleClearOperation(objectStoreId, callbacks);
}
void IDBDatabaseBackendImpl::transactionStarted(IDBTransactionBackendInterface* transaction)
void IDBDatabaseBackendImpl::transactionStarted(IDBTransactionBackend* transaction)
{
if (transaction->mode() == IndexedDB::TransactionVersionChange) {
ASSERT(!m_runningVersionChangeTransaction);
......@@ -355,9 +355,9 @@ void IDBDatabaseBackendImpl::transactionStarted(IDBTransactionBackendInterface*
}
}
void IDBDatabaseBackendImpl::transactionFinished(IDBTransactionBackendInterface* rawTransaction)
void IDBDatabaseBackendImpl::transactionFinished(IDBTransactionBackend* rawTransaction)
{
RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
RefPtr<IDBTransactionBackend> transaction = rawTransaction;
ASSERT(m_transactions.contains(transaction->id()));
ASSERT(m_transactions.get(transaction->id()) == transaction.get());
m_transactions.remove(transaction->id());
......@@ -367,9 +367,9 @@ void IDBDatabaseBackendImpl::transactionFinished(IDBTransactionBackendInterface*
}
}
void IDBDatabaseBackendImpl::transactionFinishedAndAbortFired(IDBTransactionBackendInterface* rawTransaction)
void IDBDatabaseBackendImpl::transactionFinishedAndAbortFired(IDBTransactionBackend* rawTransaction)
{
RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
RefPtr<IDBTransactionBackend> 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.
......@@ -382,9 +382,9 @@ void IDBDatabaseBackendImpl::transactionFinishedAndAbortFired(IDBTransactionBack
}
}
void IDBDatabaseBackendImpl::transactionFinishedAndCompleteFired(IDBTransactionBackendInterface* rawTransaction)
void IDBDatabaseBackendImpl::transactionFinishedAndCompleteFired(IDBTransactionBackend* rawTransaction)
{
RefPtr<IDBTransactionBackendInterface> transaction = rawTransaction;
RefPtr<IDBTransactionBackend> transaction = rawTransaction;
if (transaction->mode() == IndexedDB::TransactionVersionChange)
processPendingCalls();
}
......@@ -465,7 +465,7 @@ void IDBDatabaseBackendImpl::processPendingOpenCalls(bool success)
void IDBDatabaseBackendImpl::createTransaction(int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, unsigned short mode)
{
RefPtr<IDBTransactionBackendInterface> transaction = m_factory->maybeCreateTransactionBackend(this, transactionId, callbacks, objectStoreIds, static_cast<IndexedDB::TransactionMode>(mode));
RefPtr<IDBTransactionBackend> transaction = m_factory->maybeCreateTransactionBackend(this, transactionId, callbacks, objectStoreIds, static_cast<IndexedDB::TransactionMode>(mode));
if (!transaction)
return;
......@@ -558,7 +558,7 @@ void IDBDatabaseBackendImpl::runIntVersionChangeTransaction(PassRefPtr<IDBCallba
Vector<int64_t> objectStoreIds;
createTransaction(transactionId, databaseCallbacks, objectStoreIds, IndexedDB::TransactionVersionChange);
RefPtr<IDBTransactionBackendInterface> transaction = m_transactions.get(transactionId);
RefPtr<IDBTransactionBackend> transaction = m_transactions.get(transactionId);
transaction->scheduleVersionChangeOperation(transactionId, requestedVersion, callbacks, databaseCallbacks, m_metadata);
......
......@@ -41,7 +41,7 @@ namespace WebCore {
class IDBBackingStoreInterface;
class IDBDatabase;
class IDBFactoryBackendInterface;
class IDBTransactionBackendInterface;
class IDBTransactionBackend;
class IDBTransactionCoordinator;
class IDBDatabaseBackendImpl FINAL : public IDBDatabaseBackendInterface {
......@@ -75,10 +75,10 @@ public:
virtual void deleteIndex(int64_t transactionId, int64_t objectStoreId, int64_t indexId);
IDBTransactionCoordinator* transactionCoordinator() const { return m_transactionCoordinator.get(); }
void transactionStarted(IDBTransactionBackendInterface*);
void transactionFinished(IDBTransactionBackendInterface*);
void transactionFinishedAndCompleteFired(IDBTransactionBackendInterface*);
void transactionFinishedAndAbortFired(IDBTransactionBackendInterface*);
void transactionStarted(IDBTransactionBackend*);
void transactionFinished(IDBTransactionBackend*);
void transactionFinishedAndCompleteFired(IDBTransactionBackend*);
void transactionFinishedAndAbortFired(IDBTransactionBackend*);
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;
......@@ -126,9 +126,9 @@ private:
RefPtr<IDBFactoryBackendInterface> m_factory;
OwnPtr<IDBTransactionCoordinator> m_transactionCoordinator;
RefPtr<IDBTransactionBackendInterface> m_runningVersionChangeTransaction;
RefPtr<IDBTransactionBackend> m_runningVersionChangeTransaction;
typedef HashMap<int64_t, IDBTransactionBackendInterface*> TransactionMap;
typedef HashMap<int64_t, IDBTransactionBackend*> TransactionMap;
TransactionMap m_transactions;
Deque<OwnPtr<IDBPendingOpenCall>> m_pendingOpenCalls;
......
......@@ -43,7 +43,7 @@ class IDBCallbacks;
class IDBDatabase;
class IDBDatabaseBackendInterface;
class IDBDatabaseCallbacks;
class IDBTransactionBackendInterface;
class IDBTransactionBackend;
class SecurityOrigin;
class ScriptExecutionContext;
......@@ -64,9 +64,9 @@ public:
virtual void removeIDBDatabaseBackend(const String& uniqueIdentifier) = 0;
virtual PassRefPtr<IDBTransactionBackendInterface> maybeCreateTransactionBackend(IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode) = 0;
virtual PassRefPtr<IDBTransactionBackend> maybeCreateTransactionBackend(IDBDatabaseBackendInterface*, int64_t transactionId, PassRefPtr<IDBDatabaseCallbacks>, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode) = 0;
virtual PassRefPtr<IDBCursorBackend> createCursorBackend(IDBTransactionBackendInterface&, IDBBackingStoreCursorInterface&, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, int64_t objectStoreId) = 0;
virtual PassRefPtr<IDBCursorBackend> createCursorBackend(IDBTransactionBackend&, IDBBackingStoreCursorInterface&, IndexedDB::CursorType, IDBDatabaseBackendInterface::TaskType, int64_t objectStoreId) = 0;
};
} // namespace WebCore
......
......@@ -24,7 +24,7 @@
*/
#include "config.h"
#include "IDBTransactionBackendImpl.h"
#include "IDBTransactionBackend.h"
#if ENABLE(INDEXED_DATABASE)
......@@ -40,27 +40,27 @@
namespace WebCore {
PassRefPtr<IDBTransactionBackendImpl> IDBTransactionBackendImpl::create(IDBDatabaseBackendImpl* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const Vector<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
PassRefPtr<IDBTransactionBackend> IDBTransactionBackend::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)
objectStoreHashSet.add(objectStoreIds[i]);
return adoptRef(new IDBTransactionBackendImpl(databaseBackend, id, callbacks, objectStoreHashSet, mode));
return adoptRef(new IDBTransactionBackend(databaseBackend, id, callbacks, objectStoreHashSet, mode));
}
IDBTransactionBackendImpl::IDBTransactionBackendImpl(IDBDatabaseBackendImpl* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const HashSet<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
: IDBTransactionBackendInterface(id)
, m_objectStoreIds(objectStoreIds)
IDBTransactionBackend::IDBTransactionBackend(IDBDatabaseBackendImpl* databaseBackend, int64_t id, PassRefPtr<IDBDatabaseCallbacks> callbacks, const HashSet<int64_t>& objectStoreIds, IndexedDB::TransactionMode mode)
: m_objectStoreIds(objectStoreIds)
, m_mode(mode)
, m_state(Unused)
, m_commitPending(false)
, m_callbacks(callbacks)
, m_database(databaseBackend)
, m_backingStoreTransaction(databaseBackend->backingStore()->createBackingStoreTransaction())
, m_taskTimer(this, &IDBTransactionBackendImpl::taskTimerFired)
, m_taskTimer(this, &IDBTransactionBackend::taskTimerFired)
, m_pendingPreemptiveEvents(0)
, m_backingStore(databaseBackend->backingStore())
, m_id(id)
{
// We pass a reference of this object before it can be adopted.
relaxAdoptionRequirement();
......@@ -68,13 +68,13 @@ IDBTransactionBackendImpl::IDBTransactionBackendImpl(IDBDatabaseBackendImpl* dat
m_database->transactionCoordinator()->didCreateTransaction(this);
}
IDBTransactionBackendImpl::~IDBTransactionBackendImpl()
IDBTransactionBackend::~IDBTransactionBackend()
{
// It shouldn't be possible for this object to get deleted until it's either complete or aborted.
ASSERT(m_state == Finished);
}
void IDBTransactionBackendImpl::scheduleTask(IDBDatabaseBackendInterface::TaskType type, PassOwnPtr<IDBOperation> task, PassOwnPtr<IDBOperation> abortTask)
void IDBTransactionBackend::scheduleTask(IDBDatabaseBackendInterface::TaskType type, PassOwnPtr<IDBOperation> task, PassOwnPtr<IDBOperation> abortTask)
{
if (m_state == Finished)
return;
......@@ -93,14 +93,14 @@ void IDBTransactionBackendImpl::scheduleTask(IDBDatabaseBackendInterface::TaskTy
m_taskTimer.startOneShot(0);
}
void IDBTransactionBackendImpl::abort()
void IDBTransactionBackend::abort()
{
abort(IDBDatabaseError::create(IDBDatabaseException::UnknownError, "Internal error (unknown cause)"));
}
void IDBTransactionBackendImpl::abort(PassRefPtr<IDBDatabaseError> error)
void IDBTransactionBackend::abort(PassRefPtr<IDBDatabaseError> error)
{
LOG(StorageAPI, "IDBTransactionBackendImpl::abort");
LOG(StorageAPI, "IDBTransactionBackend::abort");
if (m_state == Finished)
return;
......@@ -109,7 +109,7 @@ void IDBTransactionBackendImpl::abort(PassRefPtr<IDBDatabaseError> error)
// The last reference to this object may be released while performing the
// abort steps below. We therefore take a self reference to keep ourselves
// alive while executing this method.
Ref<IDBTransactionBackendImpl> protect(*this);
Ref<IDBTransactionBackend> protect(*this);
m_state = Finished;
m_taskTimer.stop();
......@@ -143,27 +143,27 @@ void IDBTransactionBackendImpl::abort(PassRefPtr<IDBDatabaseError> error)
m_database = 0;
}
bool IDBTransactionBackendImpl::isTaskQueueEmpty() const
bool IDBTransactionBackend::isTaskQueueEmpty() const
{
return m_preemptiveTaskQueue.isEmpty() && m_taskQueue.isEmpty();
}
bool IDBTransactionBackendImpl::hasPendingTasks() const
bool IDBTransactionBackend::hasPendingTasks() const
{
return m_pendingPreemptiveEvents || !isTaskQueueEmpty();
}
void IDBTransactionBackendImpl::registerOpenCursor(IDBCursorBackend* cursor)
void IDBTransactionBackend::registerOpenCursor(IDBCursorBackend* cursor)
{
m_openCursors.add(cursor);
}
void IDBTransactionBackendImpl::unregisterOpenCursor(IDBCursorBackend* cursor)
void IDBTransactionBackend::unregisterOpenCursor(IDBCursorBackend* cursor)
{
m_openCursors.remove(cursor);
}
void IDBTransactionBackendImpl::run()
void IDBTransactionBackend::run()
{
// TransactionCoordinator has started this transaction. Schedule a timer
// to process the first task.
......@@ -173,7 +173,7 @@ void IDBTransactionBackendImpl::run()
m_taskTimer.startOneShot(0);
}
void IDBTransactionBackendImpl::start()
void IDBTransactionBackend::start()
{
ASSERT(m_state == Unused);
......@@ -182,9 +182,9 @@ void IDBTransactionBackendImpl::start()
m_database->transactionStarted(this);
}
void IDBTransactionBackendImpl::commit()
void IDBTransactionBackend::commit()
{
LOG(StorageAPI, "IDBTransactionBackendImpl::commit");
LOG(StorageAPI, "IDBTransactionBackend::commit");
// In multiprocess ports, front-end may have requested a commit but an abort has already
// been initiated asynchronously by the back-end.
......@@ -202,7 +202,7 @@ void IDBTransactionBackendImpl::commit()
// The last reference to this object may be released while performing the
// commit steps below. We therefore take a self reference to keep ourselves
// alive while executing this method.
Ref<IDBTransactionBackendImpl> protect(*this);
Ref<IDBTransactionBackend> protect(*this);
bool unused = m_state == Unused;
m_state = Finished;
......@@ -232,9 +232,9 @@ void IDBTransactionBackendImpl::commit()
m_database = 0;
}
void IDBTransactionBackendImpl::taskTimerFired(Timer<IDBTransactionBackendImpl>*)
void IDBTransactionBackend::taskTimerFired(Timer<IDBTransactionBackend>*)
{
LOG(StorageAPI, "IDBTransactionBackendImpl::taskTimerFired");
LOG(StorageAPI, "IDBTransactionBackend::taskTimerFired");
ASSERT(!isTaskQueueEmpty());
if (m_state == StartPending) {
......@@ -245,7 +245,7 @@ void IDBTransactionBackendImpl::taskTimerFired(Timer<IDBTransactionBackendImpl>*
// The last reference to this object may be released while performing the
// tasks. Take take a self reference to keep this object alive so that
// the loop termination conditions can be checked.
Ref<IDBTransactionBackendImpl> protect(*this);
Ref<IDBTransactionBackend> protect(*this);
TaskQueue* taskQueue = m_pendingPreemptiveEvents ? &m_preemptiveTaskQueue : &m_taskQueue;
while (!taskQueue->isEmpty() && m_state != Finished) {
......@@ -263,74 +263,74 @@ void IDBTransactionBackendImpl::taskTimerFired(Timer<IDBTransactionBackendImpl>*
commit();
}
void IDBTransactionBackendImpl::closeOpenCursors()
void IDBTransactionBackend::closeOpenCursors()
{
for (HashSet<IDBCursorBackend*>::iterator i = m_openCursors.begin(); i != m_openCursors.end(); ++i)
(*i)->close();
m_openCursors.clear();
}
void IDBTransactionBackendImpl::scheduleCreateObjectStoreOperation(const IDBObjectStoreMetadata& objectStoreMetadata)
void IDBTransactionBackend::scheduleCreateObjectStoreOperation(const IDBObjectStoreMetadata& objectStoreMetadata)
{
scheduleTask(CreateObjectStoreOperation::create(this, m_backingStore.get(), objectStoreMetadata), CreateObjectStoreAbortOperation::create(this, objectStoreMetadata.id));
}
void IDBTransactionBackendImpl::scheduleDeleteObjectStoreOperation(const IDBObjectStoreMetadata& objectStoreMetadata)
void IDBTransactionBackend::scheduleDeleteObjectStoreOperation(const IDBObjectStoreMetadata& objectStoreMetadata)
{
scheduleTask(DeleteObjectStoreOperation::create(this, m_backingStore.get(), objectStoreMetadata), DeleteObjectStoreAbortOperation::create(this, objectStoreMetadata));
}
void IDBTransactionBackendImpl::scheduleVersionChangeOperation(int64_t transactionId, int64_t requestedVersion, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const IDBDatabaseMetadata& metadata)
void IDBTransactionBackend::scheduleVersionChangeOperation(int64_t transactionId, int64_t requestedVersion, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const IDBDatabaseMetadata& metadata)
{
scheduleTask(IDBDatabaseBackendImpl::VersionChangeOperation::create(this, transactionId, requestedVersion, callbacks, databaseCallbacks), IDBDatabaseBackendImpl::VersionChangeAbortOperation::create(this, String::number(metadata.version), metadata.version));
}
void IDBTransactionBackendImpl::scheduleCreateIndexOperation(int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
void IDBTransactionBackend::scheduleCreateIndexOperation(int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
{
scheduleTask(CreateIndexOperation::create(this, m_backingStore.get(), objectStoreId, indexMetadata), CreateIndexAbortOperation::create(this, objectStoreId, indexMetadata.id));
}
void IDBTransactionBackendImpl::scheduleDeleteIndexOperation(int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
void IDBTransactionBackend::scheduleDeleteIndexOperation(int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
{
scheduleTask(DeleteIndexOperation::create(this, m_backingStore.get(), objectStoreId, indexMetadata), DeleteIndexAbortOperation::create(this, objectStoreId, indexMetadata));
}
void IDBTransactionBackendImpl::scheduleGetOperation(const IDBDatabaseMetadata& metadata, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks)
void IDBTransactionBackend::scheduleGetOperation(const IDBDatabaseMetadata& metadata, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks)
{
scheduleTask(GetOperation::create(this, m_backingStore.get(), metadata, objectStoreId, indexId, keyRange, cursorType, callbacks));
}
void IDBTransactionBackendImpl::schedulePutOperation(const IDBObjectStoreMetadata& objectStoreMetadata, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, IDBDatabaseBackendInterface::PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
void IDBTransactionBackend::schedulePutOperation(const IDBObjectStoreMetadata& objectStoreMetadata, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, IDBDatabaseBackendInterface::PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
{
scheduleTask(PutOperation::create(this, m_backingStore.get(), database().id(), objectStoreMetadata, value, key, putMode, callbacks, indexIds, indexKeys));
}
void IDBTransactionBackendImpl::scheduleSetIndexesReadyOperation(size_t indexCount)
void IDBTransactionBackend::scheduleSetIndexesReadyOperation(size_t indexCount)
{
scheduleTask(IDBDatabaseBackendInterface::PreemptiveTask, SetIndexesReadyOperation::create(this, indexCount));
}
void IDBTransactionBackendImpl::scheduleOpenCursorOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirection direction, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, PassRefPtr<IDBCallbacks> callbacks)
void IDBTransactionBackend::scheduleOpenCursorOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirection direction, IndexedDB::CursorType cursorType, IDBDatabaseBackendInterface::TaskType taskType, PassRefPtr<IDBCallbacks> callbacks)
{
scheduleTask(OpenCursorOperation::create(this, m_backingStore.get(), database().id(), objectStoreId, indexId, keyRange, direction, cursorType, taskType, callbacks));
}
void IDBTransactionBackendImpl::scheduleCountOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
void IDBTransactionBackend::scheduleCountOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
{