Bug 1545196 - Avoid copying large RequestParams sub-object in ObjectStoreAddOrPutRequestOp. r=dom-workers-and-storage-reviewers,janv

Differential Revision: https://phabricator.services.mozilla.com/D59726

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Simon Giesecke 2020-01-15 09:32:31 +00:00
Родитель c3c6689c8b
Коммит 99f4d7d6d8
2 изменённых файлов: 14 добавлений и 8 удалений

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

@ -6433,7 +6433,7 @@ class TransactionBase {
CommitOrAbort();
}
PBackgroundIDBRequestParent* AllocRequest(const RequestParams& aParams,
PBackgroundIDBRequestParent* AllocRequest(RequestParams&& aParams,
bool aTrustParams);
bool StartRequest(PBackgroundIDBRequestParent* aActor);
@ -7415,7 +7415,7 @@ class ObjectStoreAddOrPutRequestOp final : public NormalTransactionOp {
private:
// Only created by TransactionBase.
ObjectStoreAddOrPutRequestOp(RefPtr<TransactionBase> aTransaction,
const RequestParams& aParams);
RequestParams&& aParams);
~ObjectStoreAddOrPutRequestOp() override = default;
@ -14658,7 +14658,7 @@ void TransactionBase::Invalidate() {
}
PBackgroundIDBRequestParent* TransactionBase::AllocRequest(
const RequestParams& aParams, bool aTrustParams) {
RequestParams&& aParams, bool aTrustParams) {
AssertIsOnBackgroundThread();
MOZ_ASSERT(aParams.type() != RequestParams::T__None);
@ -14682,7 +14682,7 @@ PBackgroundIDBRequestParent* TransactionBase::AllocRequest(
switch (aParams.type()) {
case RequestParams::TObjectStoreAddParams:
case RequestParams::TObjectStorePutParams:
actor = new ObjectStoreAddOrPutRequestOp(this, aParams);
actor = new ObjectStoreAddOrPutRequestOp(this, std::move(aParams));
break;
case RequestParams::TObjectStoreGetParams:
@ -24702,11 +24702,12 @@ mozilla::ipc::IPCResult NormalTransactionOp::RecvContinue(
}
ObjectStoreAddOrPutRequestOp::ObjectStoreAddOrPutRequestOp(
RefPtr<TransactionBase> aTransaction, const RequestParams& aParams)
RefPtr<TransactionBase> aTransaction, RequestParams&& aParams)
: NormalTransactionOp(std::move(aTransaction)),
mParams(aParams.type() == RequestParams::TObjectStoreAddParams
? aParams.get_ObjectStoreAddParams().commonParams()
: aParams.get_ObjectStorePutParams().commonParams()),
mParams(
std::move(aParams.type() == RequestParams::TObjectStoreAddParams
? aParams.get_ObjectStoreAddParams().commonParams()
: aParams.get_ObjectStorePutParams().commonParams())),
mGroup(Transaction().GetDatabase()->Group()),
mOrigin(Transaction().GetDatabase()->Origin()),
mPersistenceType(Transaction().GetDatabase()->Type()),

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

@ -78,6 +78,11 @@ struct SerializedStructuredCloneBuffer final {
SerializedStructuredCloneBuffer()
: data(JS::StructuredCloneScope::Unassigned) {}
SerializedStructuredCloneBuffer(SerializedStructuredCloneBuffer&&) noexcept =
default;
SerializedStructuredCloneBuffer& operator=(
SerializedStructuredCloneBuffer&&) noexcept = default;
SerializedStructuredCloneBuffer(const SerializedStructuredCloneBuffer& aOther)
: SerializedStructuredCloneBuffer() {
*this = aOther;