summaryrefslogtreecommitdiffstats
path: root/dom/indexedDB/IDBTransaction.h
diff options
context:
space:
mode:
Diffstat (limited to 'dom/indexedDB/IDBTransaction.h')
-rw-r--r--dom/indexedDB/IDBTransaction.h32
1 files changed, 29 insertions, 3 deletions
diff --git a/dom/indexedDB/IDBTransaction.h b/dom/indexedDB/IDBTransaction.h
index 65fefddfe5..9feafb3c68 100644
--- a/dom/indexedDB/IDBTransaction.h
+++ b/dom/indexedDB/IDBTransaction.h
@@ -63,6 +63,15 @@ class IDBTransaction final
Invalid
};
+ enum struct Durability {
+ Default = 0,
+ Strict,
+ Relaxed,
+
+ // Only needed for IPC serialization helper, should never be used in code.
+ Invalid
+ };
+
enum struct ReadyState { Active, Inactive, Committing, Finished };
private:
@@ -90,6 +99,11 @@ class IDBTransaction final
int64_t mNextObjectStoreId;
int64_t mNextIndexId;
+ // Request ids are issued starting from 0 and incremented by one as we send
+ // actor creation messages to the parent process. Used to support the
+ // explicit commit() request.
+ int64_t mNextRequestId;
+
nsresult mAbortCode; ///< The result that caused the transaction to be
///< aborted, or NS_OK if not aborted.
///< NS_ERROR_DOM_INDEXEDDB_ABORT_ERR indicates that the
@@ -108,6 +122,7 @@ class IDBTransaction final
ReadyState mReadyState = ReadyState::Active;
FlippedOnce<false> mStarted;
const Mode mMode;
+ const Durability mDurability;
bool mRegistered; ///< Whether mDatabase->RegisterTransaction() has been
///< called (which may not be the case if construction was
@@ -130,7 +145,8 @@ class IDBTransaction final
[[nodiscard]] static SafeRefPtr<IDBTransaction> Create(
JSContext* aCx, IDBDatabase* aDatabase,
- const nsTArray<nsString>& aObjectStoreNames, Mode aMode);
+ const nsTArray<nsString>& aObjectStoreNames, Mode aMode,
+ Durability aDurability);
static Maybe<IDBTransaction&> MaybeCurrent();
@@ -232,6 +248,11 @@ class IDBTransaction final
return mMode;
}
+ Durability GetDurability() const {
+ AssertIsOnOwningThread();
+ return mDurability;
+ }
+
uint32_t GetPendingRequestCount() const { return mPendingRequestCount; }
IDBDatabase* Database() const {
@@ -280,6 +301,9 @@ class IDBTransaction final
// Only for Mode::VersionChange transactions.
int64_t NextIndexId();
+ // See the comment for mNextRequestId.
+ int64_t NextRequestId();
+
void InvalidateCursorCaches();
void RegisterCursor(IDBCursor& aCursor);
void UnregisterCursor(IDBCursor& aCursor);
@@ -299,6 +323,8 @@ class IDBTransaction final
IDBTransactionMode GetMode(ErrorResult& aRv) const;
+ IDBTransactionDurability GetDurability(ErrorResult& aRv) const;
+
DOMException* GetError() const;
[[nodiscard]] RefPtr<IDBObjectStore> ObjectStore(const nsAString& aName,
@@ -323,8 +349,8 @@ class IDBTransaction final
public:
IDBTransaction(IDBDatabase* aDatabase,
const nsTArray<nsString>& aObjectStoreNames, Mode aMode,
- nsString aFilename, uint32_t aLineNo, uint32_t aColumn,
- CreatedFromFactoryFunction aDummy);
+ Durability aDurability, nsString aFilename, uint32_t aLineNo,
+ uint32_t aColumn, CreatedFromFactoryFunction aDummy);
private:
~IDBTransaction();