Commit 05a35ca3 authored by beidson@apple.com's avatar beidson@apple.com

Move execution of IDBTransactionBackendOperations to the IDBServerConnection

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

Reviewed by Tim Horton.

Source/WebCore:

Each IDBOperation has it’s ::perform() moved to a method on IDBServerConnection.
This almost removes all knowledge of the backing stores from the front end.

* Modules/indexeddb/IDBDatabaseBackend.cpp:
(WebCore::IDBDatabaseBackend::clearObjectStore):
(WebCore::IDBDatabaseBackend::runIntVersionChangeTransaction):
* Modules/indexeddb/IDBDatabaseBackend.h:

* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::clear):

Add methods to reflect each transaction backend operation:
* Modules/indexeddb/IDBServerConnection.h:

Schedule certain operations with callbacks:
* Modules/indexeddb/IDBTransactionBackend.cpp:
(WebCore::IDBTransactionBackend::scheduleVersionChangeOperation):
(WebCore::IDBTransactionBackend::schedulePutOperation):
(WebCore::IDBTransactionBackend::scheduleOpenCursorOperation):
(WebCore::IDBTransactionBackend::scheduleCountOperation):
(WebCore::IDBTransactionBackend::scheduleDeleteRangeOperation):
(WebCore::IDBTransactionBackend::scheduleClearObjectStoreOperation):
* Modules/indexeddb/IDBTransactionBackend.h:

Make each operation’s perform() method defer to the IDBServerConnection (with a callback):
* Modules/indexeddb/IDBTransactionBackendOperations.cpp:
(WebCore::CreateObjectStoreOperation::perform):
(WebCore::CreateIndexOperation::perform):
(WebCore::CreateIndexAbortOperation::perform):
(WebCore::DeleteIndexOperation::perform):
(WebCore::DeleteIndexAbortOperation::perform):
(WebCore::GetOperation::perform):
(WebCore::PutOperation::perform):
(WebCore::SetIndexesReadyOperation::perform):
(WebCore::OpenCursorOperation::perform):
(WebCore::CountOperation::perform):
(WebCore::DeleteRangeOperation::perform):
(WebCore::ClearObjectStoreOperation::perform):
(WebCore::DeleteObjectStoreOperation::perform):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::perform):
(WebCore::CreateObjectStoreAbortOperation::perform):

Add accessors to each operation’s data members so the IDBServerConnection has everything it needs:
* Modules/indexeddb/IDBTransactionBackendOperations.h:
(WebCore::CreateObjectStoreOperation::objectStoreMetadata):
(WebCore::DeleteObjectStoreOperation::objectStoreMetadata):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::create):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::version):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::callbacks):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::databaseCallbacks):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::VersionChangeOperation):
(WebCore::CreateObjectStoreAbortOperation::CreateObjectStoreAbortOperation):
(WebCore::CreateIndexOperation::objectStoreID):
(WebCore::CreateIndexOperation::idbIndexMetadata):
(WebCore::CreateIndexOperation::CreateIndexOperation):
(WebCore::CreateIndexAbortOperation::CreateIndexAbortOperation):
(WebCore::DeleteIndexOperation::objectStoreID):
(WebCore::DeleteIndexOperation::idbIndexMetadata):
(WebCore::DeleteIndexOperation::DeleteIndexOperation):
(WebCore::DeleteIndexAbortOperation::DeleteIndexAbortOperation):
(WebCore::GetOperation::objectStoreID):
(WebCore::GetOperation::indexID):
(WebCore::GetOperation::cursorType):
(WebCore::GetOperation::keyRange):
(WebCore::GetOperation::callbacks):
(WebCore::GetOperation::autoIncrement):
(WebCore::GetOperation::keyPath):
(WebCore::GetOperation::GetOperation):
(WebCore::PutOperation::create):
(WebCore::PutOperation::putMode):
(WebCore::PutOperation::objectStore):
(WebCore::PutOperation::key):
(WebCore::PutOperation::indexIDs):
(WebCore::PutOperation::indexKeys):
(WebCore::PutOperation::callbacks):
(WebCore::PutOperation::value):
(WebCore::PutOperation::PutOperation):
(WebCore::OpenCursorOperation::create):
(WebCore::OpenCursorOperation::objectStoreID):
(WebCore::OpenCursorOperation::indexID):
(WebCore::OpenCursorOperation::direction):
(WebCore::OpenCursorOperation::cursorType):
(WebCore::OpenCursorOperation::taskType):
(WebCore::OpenCursorOperation::keyRange):
(WebCore::OpenCursorOperation::cursorDirection):
(WebCore::OpenCursorOperation::callbacks):
(WebCore::OpenCursorOperation::OpenCursorOperation):
(WebCore::CountOperation::create):
(WebCore::CountOperation::objectStoreID):
(WebCore::CountOperation::indexID):
(WebCore::CountOperation::keyRange):
(WebCore::CountOperation::callbacks):
(WebCore::CountOperation::CountOperation):
(WebCore::DeleteRangeOperation::create):
(WebCore::DeleteRangeOperation::objectStoreID):
(WebCore::DeleteRangeOperation::callbacks):
(WebCore::DeleteRangeOperation::keyRange):
(WebCore::DeleteRangeOperation::DeleteRangeOperation):
(WebCore::ClearObjectStoreOperation::create):
(WebCore::ClearObjectStoreOperation::objectStoreID):
(WebCore::ClearObjectStoreOperation::callbacks):
(WebCore::ClearObjectStoreOperation::ClearObjectStoreOperation):

Implement each operation in terms of the appropriate backing store, then perform the callback:
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp:
(WebCore::IDBServerConnectionLevelDB::createObjectStore):
(WebCore::IDBServerConnectionLevelDB::createIndex):
(WebCore::IDBServerConnectionLevelDB::deleteIndex):
(WebCore::IDBServerConnectionLevelDB::get):
(WebCore::IDBServerConnectionLevelDB::put):
(WebCore::IDBServerConnectionLevelDB::openCursor):
(WebCore::IDBServerConnectionLevelDB::count):
(WebCore::IDBServerConnectionLevelDB::deleteRange):
(WebCore::IDBServerConnectionLevelDB::clearObjectStore):
(WebCore::IDBServerConnectionLevelDB::deleteObjectStore):
(WebCore::IDBServerConnectionLevelDB::changeDatabaseVersion):
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h:

* WebCore.xcodeproj/project.pbxproj:

Source/WebKit2:

* WebProcess/Databases/IndexedDB/WebProcessIDBDatabaseBackend.h:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@159353 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a0d14596
2013-11-15 Brady Eidson <beidson@apple.com>
Move execution of IDBTransactionBackendOperations to the IDBServerConnection
https://bugs.webkit.org/show_bug.cgi?id=124385
Reviewed by Tim Horton.
Each IDBOperation has it’s ::perform() moved to a method on IDBServerConnection.
This almost removes all knowledge of the backing stores from the front end.
* Modules/indexeddb/IDBDatabaseBackend.cpp:
(WebCore::IDBDatabaseBackend::clearObjectStore):
(WebCore::IDBDatabaseBackend::runIntVersionChangeTransaction):
* Modules/indexeddb/IDBDatabaseBackend.h:
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::clear):
Add methods to reflect each transaction backend operation:
* Modules/indexeddb/IDBServerConnection.h:
Schedule certain operations with callbacks:
* Modules/indexeddb/IDBTransactionBackend.cpp:
(WebCore::IDBTransactionBackend::scheduleVersionChangeOperation):
(WebCore::IDBTransactionBackend::schedulePutOperation):
(WebCore::IDBTransactionBackend::scheduleOpenCursorOperation):
(WebCore::IDBTransactionBackend::scheduleCountOperation):
(WebCore::IDBTransactionBackend::scheduleDeleteRangeOperation):
(WebCore::IDBTransactionBackend::scheduleClearObjectStoreOperation):
* Modules/indexeddb/IDBTransactionBackend.h:
Make each operation’s perform() method defer to the IDBServerConnection (with a callback):
* Modules/indexeddb/IDBTransactionBackendOperations.cpp:
(WebCore::CreateObjectStoreOperation::perform):
(WebCore::CreateIndexOperation::perform):
(WebCore::CreateIndexAbortOperation::perform):
(WebCore::DeleteIndexOperation::perform):
(WebCore::DeleteIndexAbortOperation::perform):
(WebCore::GetOperation::perform):
(WebCore::PutOperation::perform):
(WebCore::SetIndexesReadyOperation::perform):
(WebCore::OpenCursorOperation::perform):
(WebCore::CountOperation::perform):
(WebCore::DeleteRangeOperation::perform):
(WebCore::ClearObjectStoreOperation::perform):
(WebCore::DeleteObjectStoreOperation::perform):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::perform):
(WebCore::CreateObjectStoreAbortOperation::perform):
Add accessors to each operation’s data members so the IDBServerConnection has everything it needs:
* Modules/indexeddb/IDBTransactionBackendOperations.h:
(WebCore::CreateObjectStoreOperation::objectStoreMetadata):
(WebCore::DeleteObjectStoreOperation::objectStoreMetadata):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::create):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::version):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::callbacks):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::databaseCallbacks):
(WebCore::IDBDatabaseBackend::VersionChangeOperation::VersionChangeOperation):
(WebCore::CreateObjectStoreAbortOperation::CreateObjectStoreAbortOperation):
(WebCore::CreateIndexOperation::objectStoreID):
(WebCore::CreateIndexOperation::idbIndexMetadata):
(WebCore::CreateIndexOperation::CreateIndexOperation):
(WebCore::CreateIndexAbortOperation::CreateIndexAbortOperation):
(WebCore::DeleteIndexOperation::objectStoreID):
(WebCore::DeleteIndexOperation::idbIndexMetadata):
(WebCore::DeleteIndexOperation::DeleteIndexOperation):
(WebCore::DeleteIndexAbortOperation::DeleteIndexAbortOperation):
(WebCore::GetOperation::objectStoreID):
(WebCore::GetOperation::indexID):
(WebCore::GetOperation::cursorType):
(WebCore::GetOperation::keyRange):
(WebCore::GetOperation::callbacks):
(WebCore::GetOperation::autoIncrement):
(WebCore::GetOperation::keyPath):
(WebCore::GetOperation::GetOperation):
(WebCore::PutOperation::create):
(WebCore::PutOperation::putMode):
(WebCore::PutOperation::objectStore):
(WebCore::PutOperation::key):
(WebCore::PutOperation::indexIDs):
(WebCore::PutOperation::indexKeys):
(WebCore::PutOperation::callbacks):
(WebCore::PutOperation::value):
(WebCore::PutOperation::PutOperation):
(WebCore::OpenCursorOperation::create):
(WebCore::OpenCursorOperation::objectStoreID):
(WebCore::OpenCursorOperation::indexID):
(WebCore::OpenCursorOperation::direction):
(WebCore::OpenCursorOperation::cursorType):
(WebCore::OpenCursorOperation::taskType):
(WebCore::OpenCursorOperation::keyRange):
(WebCore::OpenCursorOperation::cursorDirection):
(WebCore::OpenCursorOperation::callbacks):
(WebCore::OpenCursorOperation::OpenCursorOperation):
(WebCore::CountOperation::create):
(WebCore::CountOperation::objectStoreID):
(WebCore::CountOperation::indexID):
(WebCore::CountOperation::keyRange):
(WebCore::CountOperation::callbacks):
(WebCore::CountOperation::CountOperation):
(WebCore::DeleteRangeOperation::create):
(WebCore::DeleteRangeOperation::objectStoreID):
(WebCore::DeleteRangeOperation::callbacks):
(WebCore::DeleteRangeOperation::keyRange):
(WebCore::DeleteRangeOperation::DeleteRangeOperation):
(WebCore::ClearObjectStoreOperation::create):
(WebCore::ClearObjectStoreOperation::objectStoreID):
(WebCore::ClearObjectStoreOperation::callbacks):
(WebCore::ClearObjectStoreOperation::ClearObjectStoreOperation):
Implement each operation in terms of the appropriate backing store, then perform the callback:
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.cpp:
(WebCore::IDBServerConnectionLevelDB::createObjectStore):
(WebCore::IDBServerConnectionLevelDB::createIndex):
(WebCore::IDBServerConnectionLevelDB::deleteIndex):
(WebCore::IDBServerConnectionLevelDB::get):
(WebCore::IDBServerConnectionLevelDB::put):
(WebCore::IDBServerConnectionLevelDB::openCursor):
(WebCore::IDBServerConnectionLevelDB::count):
(WebCore::IDBServerConnectionLevelDB::deleteRange):
(WebCore::IDBServerConnectionLevelDB::clearObjectStore):
(WebCore::IDBServerConnectionLevelDB::deleteObjectStore):
(WebCore::IDBServerConnectionLevelDB::changeDatabaseVersion):
* Modules/indexeddb/leveldb/IDBServerConnectionLevelDB.h:
* WebCore.xcodeproj/project.pbxproj:
2013-11-15 Thiago de Barros Lacerda <thiago.lacerda@openbossa.org>
Modifying RTCIceCandidate object construction to match the spec
......
......@@ -34,6 +34,7 @@
#include "IDBFactoryBackendInterface.h"
#include "IDBKeyRange.h"
#include "IDBRecordIdentifier.h"
#include "IDBServerConnection.h"
#include "IDBTransactionBackend.h"
#include "IDBTransactionCoordinator.h"
#include "Logging.h"
......@@ -301,7 +302,7 @@ void IDBDatabaseBackend::deleteRange(int64_t transactionId, int64_t objectStoreI
transaction->scheduleDeleteRangeOperation(objectStoreId, keyRange, callbacks);
}
void IDBDatabaseBackend::clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
void IDBDatabaseBackend::clearObjectStore(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
{
LOG(StorageAPI, "IDBDatabaseBackend::clear");
IDBTransactionBackend* transaction = m_transactions.get(transactionId);
......@@ -309,7 +310,7 @@ void IDBDatabaseBackend::clear(int64_t transactionId, int64_t objectStoreId, Pas
return;
ASSERT(transaction->mode() != IndexedDB::TransactionReadOnly);
transaction->scheduleClearOperation(objectStoreId, callbacks);
transaction->scheduleClearObjectStoreOperation(objectStoreId, callbacks);
}
void IDBDatabaseBackend::transactionStarted(IDBTransactionBackend* transaction)
......@@ -524,7 +525,7 @@ void IDBDatabaseBackend::runIntVersionChangeTransaction(PassRefPtr<IDBCallbacks>
createTransaction(transactionId, databaseCallbacks, objectStoreIds, IndexedDB::TransactionVersionChange);
RefPtr<IDBTransactionBackend> transaction = m_transactions.get(transactionId);
transaction->scheduleVersionChangeOperation(transactionId, requestedVersion, callbacks, databaseCallbacks, m_metadata);
transaction->scheduleVersionChangeOperation(requestedVersion, callbacks, databaseCallbacks, m_metadata);
ASSERT(!m_pendingSecondHalfOpen);
m_databaseCallbacksSet.add(databaseCallbacks);
......
......@@ -26,12 +26,11 @@
#ifndef IDBDatabaseBackend_h
#define IDBDatabaseBackend_h
#include "IDBDatabaseBackend.h"
#include "IDBDatabaseCallbacks.h"
#include "IDBKeyRange.h"
#include "IDBMetadata.h"
#include "IDBPendingDeleteCall.h"
#include "IDBPendingOpenCall.h"
#include "IDBServerConnection.h"
#include <stdint.h>
#include <wtf/Deque.h>
......@@ -46,7 +45,7 @@ class IDBDatabase;
class IDBFactoryBackendInterface;
class IDBKey;
class IDBKeyPath;
class IDBKeyRange;
class IDBServerConnection;
class IDBTransactionBackend;
class IDBTransactionCoordinator;
class SharedBuffer;
......@@ -114,7 +113,7 @@ public:
void openCursor(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, IndexedDB::CursorDirection, bool keyOnly, TaskType, PassRefPtr<IDBCallbacks>);
void count(int64_t transactionId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>);
void deleteRange(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>);
void clear(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>);
void clearObjectStore(int64_t transactionId, int64_t objectStoreId, PassRefPtr<IDBCallbacks>);
const IDBDatabaseMetadata& metadata() const { return m_metadata; }
void setCurrentVersion(uint64_t version) { m_metadata.version = version; }
......
......@@ -287,7 +287,7 @@ PassRefPtr<IDBRequest> IDBObjectStore::clear(ScriptExecutionContext* context, Ex
}
RefPtr<IDBRequest> request = IDBRequest::create(context, IDBAny::create(this), m_transaction.get());
backendDB()->clear(m_transaction->id(), id(), request);
backendDB()->clearObjectStore(m_transaction->id(), id(), request);
return request.release();
}
......
......@@ -27,6 +27,7 @@
#define IDBServerConnection_h
#include "IDBMetadata.h"
#include "IDBTransactionBackendOperations.h"
#include "IndexedDB.h"
#include <functional>
#include <wtf/HashSet.h>
......@@ -41,7 +42,9 @@ class IDBBackingStoreInterface;
class IDBBackingStoreTransactionInterface;
class IDBDatabaseError;
class IDBKey;
class IDBTransactionBackend;
struct IDBIndexMetadata;
struct IDBObjectStoreMetadata;
// This interface provides a single asynchronous layer between the web-facing frontend
......@@ -54,7 +57,6 @@ public:
// FIXME: For now, server connection provides a synchronous accessor to the in-process backing store objects.
// This is temporary and will be removed soon.
virtual IDBBackingStoreInterface* deprecatedBackingStore() = 0;
virtual IDBBackingStoreTransactionInterface* deprecatedBackingStoreTransaction(int64_t transactionID) = 0;
virtual bool isClosed() = 0;
......@@ -72,8 +74,20 @@ public:
virtual void commitTransaction(int64_t transactionID, BoolCallbackFunction successCallback) = 0;
virtual void resetTransaction(int64_t transactionID, std::function<void()> completionCallback) = 0;
virtual void rollbackTransaction(int64_t transactionID, std::function<void()> completionCallback) = 0;
virtual void setIndexKeys(int64_t transactionID, int64_t databaseID, int64_t objectStoreID, const IDBObjectStoreMetadata&, IDBKey& primaryKey, const Vector<int64_t>& indexIDs, const Vector<Vector<RefPtr<IDBKey>>>& indexKeys, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void createObjectStore(IDBTransactionBackend&, const CreateObjectStoreOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void createIndex(IDBTransactionBackend&, const CreateIndexOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void deleteIndex(IDBTransactionBackend&, const DeleteIndexOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void get(IDBTransactionBackend&, const GetOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void put(IDBTransactionBackend&, const PutOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void openCursor(IDBTransactionBackend&, const OpenCursorOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void count(IDBTransactionBackend&, const CountOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void deleteRange(IDBTransactionBackend&, const DeleteRangeOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void clearObjectStore(IDBTransactionBackend&, const ClearObjectStoreOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void deleteObjectStore(IDBTransactionBackend&, const DeleteObjectStoreOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
virtual void changeDatabaseVersion(IDBTransactionBackend&, const IDBDatabaseBackend::VersionChangeOperation&, std::function<void(PassRefPtr<IDBDatabaseError>)> completionCallback) = 0;
};
} // namespace WebCore
......
......@@ -85,15 +85,6 @@ IDBTransactionBackend::~IDBTransactionBackend()
{
// It shouldn't be possible for this object to get deleted until it's either complete or aborted.
ASSERT(m_state == Finished);
// The backing store transaction should also be gone by now.
ASSERT(!m_database->serverConnection().deprecatedBackingStoreTransaction(m_id));
}
IDBBackingStoreTransactionInterface& IDBTransactionBackend::deprecatedBackingStoreTransaction()
{
IDBBackingStoreTransactionInterface* backingStoreTransaction = m_database->serverConnection().deprecatedBackingStoreTransaction(m_id);
ASSERT(backingStoreTransaction);
return *backingStoreTransaction;
}
void IDBTransactionBackend::scheduleTask(IDBDatabaseBackend::TaskType type, PassRefPtr<IDBOperation> task, PassRefPtr<IDBSynchronousOperation> abortTask)
......@@ -311,9 +302,9 @@ void IDBTransactionBackend::scheduleDeleteObjectStoreOperation(const IDBObjectSt
scheduleTask(DeleteObjectStoreOperation::create(this, objectStoreMetadata), DeleteObjectStoreAbortOperation::create(this, objectStoreMetadata));
}
void IDBTransactionBackend::scheduleVersionChangeOperation(int64_t transactionId, int64_t requestedVersion, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const IDBDatabaseMetadata& metadata)
void IDBTransactionBackend::scheduleVersionChangeOperation(int64_t requestedVersion, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks, const IDBDatabaseMetadata& metadata)
{
scheduleTask(IDBDatabaseBackend::VersionChangeOperation::create(this, transactionId, requestedVersion, callbacks, databaseCallbacks), IDBDatabaseBackend::VersionChangeAbortOperation::create(this, String::number(metadata.version), metadata.version));
scheduleTask(IDBDatabaseBackend::VersionChangeOperation::create(this, requestedVersion, callbacks, databaseCallbacks), IDBDatabaseBackend::VersionChangeAbortOperation::create(this, String::number(metadata.version), metadata.version));
}
void IDBTransactionBackend::scheduleCreateIndexOperation(int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
......@@ -333,7 +324,7 @@ void IDBTransactionBackend::scheduleGetOperation(const IDBDatabaseMetadata& meta
void IDBTransactionBackend::schedulePutOperation(const IDBObjectStoreMetadata& objectStoreMetadata, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, IDBDatabaseBackend::PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
{
scheduleTask(PutOperation::create(this, database().id(), objectStoreMetadata, value, key, putMode, callbacks, indexIds, indexKeys));
scheduleTask(PutOperation::create(this, objectStoreMetadata, value, key, putMode, callbacks, indexIds, indexKeys));
}
void IDBTransactionBackend::scheduleSetIndexesReadyOperation(size_t indexCount)
......@@ -343,22 +334,22 @@ void IDBTransactionBackend::scheduleSetIndexesReadyOperation(size_t indexCount)
void IDBTransactionBackend::scheduleOpenCursorOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirection direction, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, PassRefPtr<IDBCallbacks> callbacks)
{
scheduleTask(OpenCursorOperation::create(this, database().id(), objectStoreId, indexId, keyRange, direction, cursorType, taskType, callbacks));
scheduleTask(OpenCursorOperation::create(this, objectStoreId, indexId, keyRange, direction, cursorType, taskType, callbacks));
}
void IDBTransactionBackend::scheduleCountOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
{
scheduleTask(CountOperation::create(this, database().id(), objectStoreId, indexId, keyRange, callbacks));
scheduleTask(CountOperation::create(this, objectStoreId, indexId, keyRange, callbacks));
}
void IDBTransactionBackend::scheduleDeleteRangeOperation(int64_t objectStoreId, PassRefPtr<IDBKeyRange> keyRange, PassRefPtr<IDBCallbacks> callbacks)
{
scheduleTask(DeleteRangeOperation::create(this, database().id(), objectStoreId, keyRange, callbacks));
scheduleTask(DeleteRangeOperation::create(this, objectStoreId, keyRange, callbacks));
}
void IDBTransactionBackend::scheduleClearOperation(int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
void IDBTransactionBackend::scheduleClearObjectStoreOperation(int64_t objectStoreId, PassRefPtr<IDBCallbacks> callbacks)
{
scheduleTask(ClearOperation::create(this, database().id(), objectStoreId, callbacks));
scheduleTask(ClearObjectStoreOperation::create(this, objectStoreId, callbacks));
}
PassRefPtr<IDBCursorBackend> IDBTransactionBackend::createCursorBackend(IDBBackingStoreCursorInterface& cursor, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, int64_t objectStoreId)
......
......@@ -32,7 +32,6 @@
#include "IDBDatabaseBackend.h"
#include "IDBDatabaseError.h"
#include "IDBOperation.h"
#include "IDBTransactionBackend.h"
#include "Timer.h"
#include <wtf/Deque.h>
#include <wtf/HashSet.h>
......@@ -64,13 +63,12 @@ public:
void addPreemptiveEvent() { m_pendingPreemptiveEvents++; }
void didCompletePreemptiveEvent() { m_pendingPreemptiveEvents--; ASSERT(m_pendingPreemptiveEvents >= 0); }
IDBBackingStoreTransactionInterface& deprecatedBackingStoreTransaction();
IDBDatabaseBackend& database() const { return *m_database; }
void scheduleCreateObjectStoreOperation(const IDBObjectStoreMetadata&);
void scheduleDeleteObjectStoreOperation(const IDBObjectStoreMetadata&);
void scheduleVersionChangeOperation(int64_t transactionId, int64_t requestedVersion, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const IDBDatabaseMetadata&);
void scheduleVersionChangeOperation(int64_t requestedVersion, PassRefPtr<IDBCallbacks>, PassRefPtr<IDBDatabaseCallbacks>, const IDBDatabaseMetadata&);
void scheduleCreateIndexOperation(int64_t objectStoreId, const IDBIndexMetadata&);
void scheduleDeleteIndexOperation(int64_t objectStoreId, const IDBIndexMetadata&);
void scheduleGetOperation(const IDBDatabaseMetadata&, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, IndexedDB::CursorType, PassRefPtr<IDBCallbacks>);
......@@ -79,7 +77,7 @@ public:
void scheduleOpenCursorOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, IndexedDB::CursorDirection, IndexedDB::CursorType, IDBDatabaseBackend::TaskType, PassRefPtr<IDBCallbacks>);
void scheduleCountOperation(int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>);
void scheduleDeleteRangeOperation(int64_t objectStoreId, PassRefPtr<IDBKeyRange>, PassRefPtr<IDBCallbacks>);
void scheduleClearOperation(int64_t objectStoreId, PassRefPtr<IDBCallbacks>);
void scheduleClearObjectStoreOperation(int64_t objectStoreId, PassRefPtr<IDBCallbacks>);
PassRefPtr<IDBCursorBackend> createCursorBackend(IDBBackingStoreCursorInterface&, IndexedDB::CursorType, IDBDatabaseBackend::TaskType, int64_t objectStoreId);
......
......@@ -28,13 +28,14 @@
#include "IDBDatabaseBackend.h"
#include "IDBOperation.h"
#include "IDBServerConnection.h"
#include "IDBTransactionBackend.h"
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
class IDBServerConnection;
class CreateObjectStoreOperation : public IDBOperation {
public:
static PassRefPtr<IDBOperation> create(IDBTransactionBackend* transaction, const IDBObjectStoreMetadata& objectStoreMetadata)
......@@ -42,6 +43,9 @@ public:
return adoptRef(new CreateObjectStoreOperation(transaction, objectStoreMetadata));
}
virtual void perform(std::function<void()> successCallback) OVERRIDE FINAL;
const IDBObjectStoreMetadata& objectStoreMetadata() const { return m_objectStoreMetadata; }
private:
CreateObjectStoreOperation(IDBTransactionBackend* transaction, const IDBObjectStoreMetadata& objectStoreMetadata)
: m_transaction(transaction)
......@@ -60,6 +64,9 @@ public:
return adoptRef(new DeleteObjectStoreOperation(transaction, objectStoreMetadata));
}
virtual void perform(std::function<void()> successCallback) OVERRIDE FINAL;
const IDBObjectStoreMetadata& objectStoreMetadata() const { return m_objectStoreMetadata; }
private:
DeleteObjectStoreOperation(IDBTransactionBackend* transaction, const IDBObjectStoreMetadata& objectStoreMetadata)
: m_transaction(transaction)
......@@ -73,15 +80,19 @@ private:
class IDBDatabaseBackend::VersionChangeOperation : public IDBOperation {
public:
static PassRefPtr<IDBOperation> create(IDBTransactionBackend* transaction, int64_t transactionId, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
static PassRefPtr<IDBOperation> create(IDBTransactionBackend* transaction, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
{
return adoptRef(new VersionChangeOperation(transaction, transactionId, version, callbacks, databaseCallbacks));
return adoptRef(new VersionChangeOperation(transaction, version, callbacks, databaseCallbacks));
}
virtual void perform(std::function<void()> successCallback) OVERRIDE FINAL;
int64_t version() const { return m_version; }
IDBCallbacks* callbacks() const { return m_callbacks.get(); }
IDBDatabaseCallbacks* databaseCallbacks() const { return m_databaseCallbacks.get(); }
private:
VersionChangeOperation(IDBTransactionBackend* transaction, int64_t transactionId, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
VersionChangeOperation(IDBTransactionBackend* transaction, int64_t version, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<IDBDatabaseCallbacks> databaseCallbacks)
: m_transaction(transaction)
, m_transactionId(transactionId)
, m_version(version)
, m_callbacks(callbacks)
, m_databaseCallbacks(databaseCallbacks)
......@@ -89,7 +100,6 @@ private:
}
RefPtr<IDBTransactionBackend> m_transaction;
int64_t m_transactionId;
int64_t m_version;
RefPtr<IDBCallbacks> m_callbacks;
RefPtr<IDBDatabaseCallbacks> m_databaseCallbacks;
......@@ -105,12 +115,12 @@ public:
private:
CreateObjectStoreAbortOperation(IDBTransactionBackend* transaction, int64_t objectStoreId)
: m_transaction(transaction)
, m_objectStoreId(objectStoreId)
, m_objectStoreID(objectStoreId)
{
}
RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_objectStoreId;
const int64_t m_objectStoreID;
};
class DeleteObjectStoreAbortOperation : public IDBSynchronousOperation {
......@@ -158,16 +168,20 @@ public:
return adoptRef(new CreateIndexOperation(transaction, objectStoreId, indexMetadata));
}
virtual void perform(std::function<void()> successCallback) OVERRIDE FINAL;
int64_t objectStoreID() const { return m_objectStoreID; }
const IDBIndexMetadata& idbIndexMetadata() const { return m_indexMetadata; }
private:
CreateIndexOperation(IDBTransactionBackend* transaction, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
: m_transaction(transaction)
, m_objectStoreId(objectStoreId)
, m_objectStoreID(objectStoreId)
, m_indexMetadata(indexMetadata)
{
}
RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_objectStoreId;
const int64_t m_objectStoreID;
const IDBIndexMetadata m_indexMetadata;
};
......@@ -181,14 +195,14 @@ public:
private:
CreateIndexAbortOperation(IDBTransactionBackend* transaction, int64_t objectStoreId, int64_t indexId)
: m_transaction(transaction)
, m_objectStoreId(objectStoreId)
, m_indexId(indexId)
, m_objectStoreID(objectStoreId)
, m_indexID(indexId)
{
}
const RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_objectStoreId;
const int64_t m_indexId;
const int64_t m_objectStoreID;
const int64_t m_indexID;
};
class DeleteIndexOperation : public IDBOperation {
......@@ -198,16 +212,20 @@ public:
return adoptRef(new DeleteIndexOperation(transaction, objectStoreId, indexMetadata));
}
virtual void perform(std::function<void()> successCallback) OVERRIDE FINAL;
int64_t objectStoreID() const { return m_objectStoreID; }
const IDBIndexMetadata& idbIndexMetadata() const { return m_indexMetadata; }
private:
DeleteIndexOperation(IDBTransactionBackend* transaction, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
: m_transaction(transaction)
, m_objectStoreId(objectStoreId)
, m_objectStoreID(objectStoreId)
, m_indexMetadata(indexMetadata)
{
}
RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_objectStoreId;
const int64_t m_objectStoreID;
const IDBIndexMetadata m_indexMetadata;
};
......@@ -221,13 +239,13 @@ public:
private:
DeleteIndexAbortOperation(IDBTransactionBackend* transaction, int64_t objectStoreId, const IDBIndexMetadata& indexMetadata)
: m_transaction(transaction)
, m_objectStoreId(objectStoreId)
, m_objectStoreID(objectStoreId)
, m_indexMetadata(indexMetadata)
{
}
RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_objectStoreId;
const int64_t m_objectStoreID;
const IDBIndexMetadata m_indexMetadata;
};
......@@ -238,12 +256,20 @@ public:
return adoptRef(new GetOperation(transaction, metadata, objectStoreId, indexId, keyRange, cursorType, callbacks));
}
virtual void perform(std::function<void()> successCallback) OVERRIDE FINAL;
int64_t objectStoreID() const { return m_objectStoreID; }
int64_t indexID() const { return m_indexID; }
IndexedDB::CursorType cursorType() const { return m_cursorType; }
IDBKeyRange* keyRange() const { return m_keyRange.get(); }
RefPtr<IDBCallbacks> callbacks() const { return m_callbacks.get(); }
bool autoIncrement() const { return m_autoIncrement; }
IDBKeyPath keyPath() const { return m_keyPath; }
private:
GetOperation(IDBTransactionBackend* transaction, const IDBDatabaseMetadata& metadata, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorType cursorType, PassRefPtr<IDBCallbacks> callbacks)
: m_transaction(transaction)
, m_databaseId(metadata.id)
, m_objectStoreId(objectStoreId)
, m_indexId(indexId)
, m_objectStoreID(objectStoreId)
, m_indexID(indexId)
, m_keyPath(metadata.objectStores.get(objectStoreId).keyPath)
, m_autoIncrement(metadata.objectStores.get(objectStoreId).autoIncrement)
, m_keyRange(keyRange)
......@@ -255,9 +281,8 @@ private:
}
RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_databaseId;
const int64_t m_objectStoreId;
const int64_t m_indexId;
const int64_t m_objectStoreID;
const int64_t m_indexID;
const IDBKeyPath m_keyPath;
const bool m_autoIncrement;
const RefPtr<IDBKeyRange> m_keyRange;
......@@ -267,33 +292,40 @@ private:
class PutOperation : public IDBOperation {
public:
static PassRefPtr<IDBOperation> create(IDBTransactionBackend* transaction, int64_t databaseId, const IDBObjectStoreMetadata& objectStore, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, IDBDatabaseBackend::PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
static PassRefPtr<IDBOperation> create(IDBTransactionBackend* transaction, const IDBObjectStoreMetadata& objectStore, PassRefPtr<SharedBuffer> value, PassRefPtr<IDBKey> key, IDBDatabaseBackend::PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
{
return adoptRef(new PutOperation(transaction, databaseId, objectStore, value, key, putMode, callbacks, indexIds, indexKeys));
return adoptRef(new PutOperation(transaction, objectStore, value, key, putMode, callbacks, indexIds, indexKeys));
}
virtual void perform(std::function<void()> successCallback) OVERRIDE FINAL;
IDBDatabaseBackend::PutMode putMode() const { return m_putMode; }
const IDBObjectStoreMetadata& objectStore() const { return m_objectStore; }
IDBKey* key() const { return m_key.get(); }
const Vector<int64_t>& indexIDs() const { return m_indexIDs; }
const Vector<IndexKeys>& indexKeys() const { return m_indexKeys; }
IDBCallbacks* callbacks() const { return m_callbacks.get(); }
SharedBuffer* value() const { return m_value.get(); }
private:
PutOperation(IDBTransactionBackend* transaction, int64_t databaseId, const IDBObjectStoreMetadata& objectStore, PassRefPtr<SharedBuffer>& value, PassRefPtr<IDBKey> key, IDBDatabaseBackend::PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
PutOperation(IDBTransactionBackend* transaction, const IDBObjectStoreMetadata& objectStore, PassRefPtr<SharedBuffer>& value, PassRefPtr<IDBKey> key, IDBDatabaseBackend::PutMode putMode, PassRefPtr<IDBCallbacks> callbacks, const Vector<int64_t>& indexIds, const Vector<IndexKeys>& indexKeys)
: m_transaction(transaction)
, m_databaseId(databaseId)
, m_objectStore(objectStore)
, m_value(value)
, m_key(key)
, m_putMode(putMode)
, m_callbacks(callbacks)
, m_indexIds(indexIds)
, m_indexIDs(indexIds)
, m_indexKeys(indexKeys)
{
}
RefPtr<IDBTransactionBackend> m_transaction;
const int64_t m_databaseId;
const IDBObjectStoreMetadata m_objectStore;
const RefPtr<SharedBuffer> m_value;
const RefPtr<IDBKey> m_key;
const IDBDatabaseBackend::PutMode m_putMode;
const RefPtr<IDBCallbacks> m_callbacks;
const Vector<int64_t> m_indexIds;
const Vector<int64_t> m_indexIDs;
const Vector<IndexKeys> m_indexKeys;
};
......@@ -317,17 +349,26 @@ private:
class OpenCursorOperation : public IDBOperation {
public:
static PassRefPtr<IDBOperation> create(IDBTransactionBackend* transaction, int64_t databaseId, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirection direction, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType, PassRefPtr<IDBCallbacks> callbacks)
static PassRefPtr<IDBOperation> create(IDBTransactionBackend* transaction, int64_t objectStoreId, int64_t indexId, PassRefPtr<IDBKeyRange> keyRange, IndexedDB::CursorDirection direction, IndexedDB::CursorType cursorType, IDBDatabaseBackend::TaskType taskType,