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>
void BackgroundCursorChild<CursorType>::SendContinueInternal(
const CursorRequestParams& aParams,
const int64_t aRequestId, const CursorRequestParams& aParams,
const CursorData<CursorType>& aCurrentData) {
AssertIsOnOwningThread();
MOZ_ASSERT(mRequest);
@ -2394,7 +2394,7 @@ void BackgroundCursorChild<CursorType>::SendContinueInternal(
// handling model disallow this?
} else {
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,
Direction aDirection);
void SendContinueInternal(const CursorRequestParams& aParams,
void SendContinueInternal(const int64_t aRequestId,
const CursorRequestParams& aParams,
const CursorData<CursorType>& aCurrentData);
void InvalidateCachedResponses();
@ -594,7 +595,8 @@ class BackgroundCursorChild final : public BackgroundCursorChildBase {
mozilla::ipc::IPCResult RecvResponse(CursorResponse&& aResponse) override;
// 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;
bool SendDeleteMe() = delete;

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

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

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

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

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

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