SQLiteIDBTransaction.h [plain text]
#ifndef SQLiteIDBTransaction_h
#define SQLiteIDBTransaction_h
#if ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
#include "IDBIdentifier.h"
#include <WebCore/IDBDatabaseBackend.h>
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
class SQLiteDatabase;
class SQLiteTransaction;
namespace IndexedDB {
enum class CursorDirection;
enum class CursorType;
enum class TransactionMode;
}
struct IDBKeyRangeData;
}
namespace WebKit {
class SQLiteIDBCursor;
class UniqueIDBDatabaseBackingStoreSQLite;
class SQLiteIDBTransaction {
WTF_MAKE_NONCOPYABLE(SQLiteIDBTransaction);
public:
static std::unique_ptr<SQLiteIDBTransaction> create(UniqueIDBDatabaseBackingStoreSQLite& backingStore, const IDBIdentifier& transactionIdentifier, WebCore::IndexedDB::TransactionMode mode)
{
return std::unique_ptr<SQLiteIDBTransaction>(new SQLiteIDBTransaction(backingStore, transactionIdentifier, mode));
}
~SQLiteIDBTransaction();
const IDBIdentifier& transactionIdentifier() const { return m_identifier; }
bool begin(WebCore::SQLiteDatabase&);
bool commit();
bool reset();
bool rollback();
SQLiteIDBCursor* openCursor(int64_t objectStoreID, int64_t indexID, WebCore::IndexedDB::CursorDirection, WebCore::IndexedDB::CursorType, WebCore::IDBDatabaseBackend::TaskType, const WebCore::IDBKeyRangeData&);
void closeCursor(SQLiteIDBCursor&);
void notifyCursorsOfChanges(int64_t objectStoreID);
WebCore::IndexedDB::TransactionMode mode() const { return m_mode; }
bool inProgress() const;
WebCore::SQLiteTransaction* sqliteTransaction() const { return m_sqliteTransaction.get(); }
private:
SQLiteIDBTransaction(UniqueIDBDatabaseBackingStoreSQLite&, const IDBIdentifier& transactionIdentifier, WebCore::IndexedDB::TransactionMode);
void clearCursors();
IDBIdentifier m_identifier;
WebCore::IndexedDB::TransactionMode m_mode;
UniqueIDBDatabaseBackingStoreSQLite& m_backingStore;
std::unique_ptr<WebCore::SQLiteTransaction> m_sqliteTransaction;
HashMap<IDBIdentifier, std::unique_ptr<SQLiteIDBCursor>> m_cursors;
};
}
#endif // ENABLE(INDEXED_DATABASE) && ENABLE(DATABASE_PROCESS)
#endif // SQLiteIDBTransaction_h