Bug 1799374 - Add support for tracking request ids to cursor continue operation; r=dom-storage-reviewers,asuth

Differential Revision: https://phabricator.services.mozilla.com/D204195
This commit is contained in:
Jan Varga 2024-03-23 08:42:40 +00:00
Родитель e72d7c69a4
Коммит 02011058af
5 изменённых файлов: 21 добавлений и 17 удалений

Просмотреть файл

@ -2211,7 +2211,7 @@ BackgroundCursorChild<CursorType>::SafeRefPtrFromThis() {
template <IDBCursorType CursorType> template <IDBCursorType CursorType>
void BackgroundCursorChild<CursorType>::SendContinueInternal( void BackgroundCursorChild<CursorType>::SendContinueInternal(
const CursorRequestParams& aParams, const int64_t aRequestId, const CursorRequestParams& aParams,
const CursorData<CursorType>& aCurrentData) { const CursorData<CursorType>& aCurrentData) {
AssertIsOnOwningThread(); AssertIsOnOwningThread();
MOZ_ASSERT(mRequest); MOZ_ASSERT(mRequest);
@ -2394,7 +2394,7 @@ void BackgroundCursorChild<CursorType>::SendContinueInternal(
// handling model disallow this? // handling model disallow this?
} else { } else {
MOZ_ALWAYS_TRUE(PBackgroundIDBCursorChild::SendContinue( MOZ_ALWAYS_TRUE(PBackgroundIDBCursorChild::SendContinue(
params, currentKey, currentObjectStoreKey)); aRequestId, params, currentKey, currentObjectStoreKey));
} }
} }

Просмотреть файл

@ -548,7 +548,8 @@ class BackgroundCursorChild final : public BackgroundCursorChildBase {
BackgroundCursorChild(NotNull<IDBRequest*> aRequest, SourceType* aSource, BackgroundCursorChild(NotNull<IDBRequest*> aRequest, SourceType* aSource,
Direction aDirection); Direction aDirection);
void SendContinueInternal(const CursorRequestParams& aParams, void SendContinueInternal(const int64_t aRequestId,
const CursorRequestParams& aParams,
const CursorData<CursorType>& aCurrentData); const CursorData<CursorType>& aCurrentData);
void InvalidateCachedResponses(); void InvalidateCachedResponses();
@ -594,7 +595,8 @@ class BackgroundCursorChild final : public BackgroundCursorChildBase {
mozilla::ipc::IPCResult RecvResponse(CursorResponse&& aResponse) override; mozilla::ipc::IPCResult RecvResponse(CursorResponse&& aResponse) override;
// Force callers to use SendContinueInternal. // Force callers to use SendContinueInternal.
bool SendContinue(const CursorRequestParams& aParams, const Key& aCurrentKey, bool SendContinue(const int64_t& aRequestId,
const CursorRequestParams& aParams, const Key& aCurrentKey,
const Key& aCurrentObjectStoreKey) = delete; const Key& aCurrentObjectStoreKey) = delete;
bool SendDeleteMe() = delete; bool SendDeleteMe() = delete;

Просмотреть файл

@ -4345,8 +4345,8 @@ class Cursor final
mozilla::ipc::IPCResult RecvDeleteMe() override; mozilla::ipc::IPCResult RecvDeleteMe() override;
mozilla::ipc::IPCResult RecvContinue( mozilla::ipc::IPCResult RecvContinue(
const CursorRequestParams& aParams, const Key& aCurrentKey, const int64_t& aRequestId, const CursorRequestParams& aParams,
const Key& aCurrentObjectStoreKey) override; const Key& aCurrentKey, const Key& aCurrentObjectStoreKey) override;
public: public:
Cursor(SafeRefPtr<TransactionBase> aTransaction, Cursor(SafeRefPtr<TransactionBase> aTransaction,
@ -4594,9 +4594,9 @@ class Cursor<CursorType>::ContinueOp final
const CursorRequestParams mParams; const CursorRequestParams mParams;
// Only created by Cursor. // Only created by Cursor.
ContinueOp(Cursor* const aCursor, CursorRequestParams aParams, ContinueOp(Cursor* const aCursor, int64_t aRequestId,
CursorPosition<CursorType> aPosition) CursorRequestParams aParams, CursorPosition<CursorType> aPosition)
: CursorOpBase(aCursor, 0), : CursorOpBase(aCursor, aRequestId),
mParams(std::move(aParams)), mParams(std::move(aParams)),
mCurrentPosition{std::move(aPosition)} { mCurrentPosition{std::move(aPosition)} {
MOZ_ASSERT(mParams.type() != CursorRequestParams::T__None); MOZ_ASSERT(mParams.type() != CursorRequestParams::T__None);
@ -11602,8 +11602,8 @@ mozilla::ipc::IPCResult Cursor<CursorType>::RecvDeleteMe() {
template <IDBCursorType CursorType> template <IDBCursorType CursorType>
mozilla::ipc::IPCResult Cursor<CursorType>::RecvContinue( mozilla::ipc::IPCResult Cursor<CursorType>::RecvContinue(
const CursorRequestParams& aParams, const Key& aCurrentKey, const int64_t& aRequestId, const CursorRequestParams& aParams,
const Key& aCurrentObjectStoreKey) { const Key& aCurrentKey, const Key& aCurrentObjectStoreKey) {
AssertIsOnBackgroundThread(); AssertIsOnBackgroundThread();
MOZ_ASSERT(aParams.type() != CursorRequestParams::T__None); MOZ_ASSERT(aParams.type() != CursorRequestParams::T__None);
MOZ_ASSERT(this->mObjectStoreMetadata); MOZ_ASSERT(this->mObjectStoreMetadata);
@ -11653,7 +11653,7 @@ mozilla::ipc::IPCResult Cursor<CursorType>::RecvContinue(
} }
const RefPtr<ContinueOp> continueOp = const RefPtr<ContinueOp> continueOp =
new ContinueOp(this, aParams, std::move(position)); new ContinueOp(this, aRequestId, aParams, std::move(position));
if (NS_WARN_IF(!continueOp->Init(*mTransaction))) { if (NS_WARN_IF(!continueOp->Init(*mTransaction))) {
continueOp->Cleanup(); continueOp->Cleanup();
return IPC_FAIL(this, "ContinueOp initialization failed!"); return IPC_FAIL(this, "ContinueOp initialization failed!");

Просмотреть файл

@ -417,7 +417,8 @@ void IDBTypedCursor<CursorType>::Continue(JSContext* const aCx,
IDB_LOG_STRINGIFY(key)); IDB_LOG_STRINGIFY(key));
} }
GetTypedBackgroundActorRef().SendContinueInternal(ContinueParams(key), mData); GetTypedBackgroundActorRef().SendContinueInternal(
mTransaction->NextRequestId(), ContinueParams(key), mData);
mContinueCalled = true; mContinueCalled = true;
} }
@ -523,6 +524,7 @@ void IDBTypedCursor<CursorType>::ContinuePrimaryKey(
IDB_LOG_STRINGIFY(key), IDB_LOG_STRINGIFY(primaryKey)); IDB_LOG_STRINGIFY(key), IDB_LOG_STRINGIFY(primaryKey));
GetTypedBackgroundActorRef().SendContinueInternal( GetTypedBackgroundActorRef().SendContinueInternal(
mTransaction->NextRequestId(),
ContinuePrimaryKeyParams(key, primaryKey), mData); ContinuePrimaryKeyParams(key, primaryKey), mData);
mContinueCalled = true; mContinueCalled = true;
@ -573,8 +575,8 @@ void IDBTypedCursor<CursorType>::Advance(const uint32_t aCount,
IDB_LOG_STRINGIFY(mSource), IDB_LOG_STRINGIFY(mDirection), aCount); IDB_LOG_STRINGIFY(mSource), IDB_LOG_STRINGIFY(mDirection), aCount);
} }
GetTypedBackgroundActorRef().SendContinueInternal(AdvanceParams(aCount), GetTypedBackgroundActorRef().SendContinueInternal(
mData); mTransaction->NextRequestId(), AdvanceParams(aCount), mData);
mContinueCalled = true; mContinueCalled = true;
} }

Просмотреть файл

@ -87,8 +87,8 @@ protocol PBackgroundIDBCursor
parent: parent:
async DeleteMe(); async DeleteMe();
async Continue(CursorRequestParams params, Key currentKey, async Continue(int64_t requestId, CursorRequestParams params,
Key currentObjectStoreKey); Key currentKey, Key currentObjectStoreKey);
child: child:
async __delete__(); async __delete__();