зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1613340 - Remove const_cast relating to SerializedStructuredCloneReadInfo. r=jld,dom-workers-and-storage-reviewers,edenchuang
Differential Revision: https://phabricator.services.mozilla.com/D61671 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
a27fa59c89
Коммит
20603da0aa
|
@ -2664,15 +2664,11 @@ void BackgroundRequestChild::HandleResponse(const nsTArray<Key>& aResponse) {
|
|||
}
|
||||
|
||||
void BackgroundRequestChild::HandleResponse(
|
||||
const SerializedStructuredCloneReadInfo& aResponse) {
|
||||
SerializedStructuredCloneReadInfo&& aResponse) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
// XXX Fix this somehow...
|
||||
auto& serializedCloneInfo =
|
||||
const_cast<SerializedStructuredCloneReadInfo&>(aResponse);
|
||||
|
||||
auto cloneReadInfo = DeserializeStructuredCloneReadInfo(
|
||||
std::move(serializedCloneInfo), mTransaction->Database());
|
||||
std::move(aResponse), mTransaction->Database());
|
||||
|
||||
if (cloneReadInfo.mHasPreprocessInfo) {
|
||||
UniquePtr<JSStructuredCloneData> cloneData = GetNextCloneData();
|
||||
|
@ -2685,7 +2681,7 @@ void BackgroundRequestChild::HandleResponse(
|
|||
}
|
||||
|
||||
void BackgroundRequestChild::HandleResponse(
|
||||
const nsTArray<SerializedStructuredCloneReadInfo>& aResponse) {
|
||||
nsTArray<SerializedStructuredCloneReadInfo>&& aResponse) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
nsTArray<StructuredCloneReadInfo> cloneReadInfos;
|
||||
|
@ -2696,14 +2692,11 @@ void BackgroundRequestChild::HandleResponse(
|
|||
cloneReadInfos.SetCapacity(count);
|
||||
|
||||
std::transform(
|
||||
aResponse.begin(), aResponse.end(), MakeBackInserter(cloneReadInfos),
|
||||
[database = mTransaction->Database(), this](
|
||||
const SerializedStructuredCloneReadInfo& constSerializedCloneInfo) {
|
||||
// XXX Fix the need for the const_cast somehow...
|
||||
auto& serializedCloneInfo =
|
||||
const_cast<SerializedStructuredCloneReadInfo&>(
|
||||
constSerializedCloneInfo);
|
||||
|
||||
std::make_move_iterator(aResponse.begin()),
|
||||
std::make_move_iterator(aResponse.end()),
|
||||
MakeBackInserter(cloneReadInfos),
|
||||
[database = mTransaction->Database(),
|
||||
this](SerializedStructuredCloneReadInfo&& serializedCloneInfo) {
|
||||
auto cloneReadInfo = DeserializeStructuredCloneReadInfo(
|
||||
std::move(serializedCloneInfo), database);
|
||||
|
||||
|
@ -2819,7 +2812,7 @@ void BackgroundRequestChild::ActorDestroy(ActorDestroyReason aWhy) {
|
|||
}
|
||||
|
||||
mozilla::ipc::IPCResult BackgroundRequestChild::Recv__delete__(
|
||||
const RequestResponse& aResponse) {
|
||||
RequestResponse&& aResponse) {
|
||||
AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mRequest);
|
||||
MOZ_ASSERT(mTransaction);
|
||||
|
@ -2845,7 +2838,8 @@ mozilla::ipc::IPCResult BackgroundRequestChild::Recv__delete__(
|
|||
break;
|
||||
|
||||
case RequestResponse::TObjectStoreGetResponse:
|
||||
HandleResponse(aResponse.get_ObjectStoreGetResponse().cloneInfo());
|
||||
HandleResponse(
|
||||
std::move(aResponse.get_ObjectStoreGetResponse().cloneInfo()));
|
||||
break;
|
||||
|
||||
case RequestResponse::TObjectStoreGetKeyResponse:
|
||||
|
@ -2853,7 +2847,8 @@ mozilla::ipc::IPCResult BackgroundRequestChild::Recv__delete__(
|
|||
break;
|
||||
|
||||
case RequestResponse::TObjectStoreGetAllResponse:
|
||||
HandleResponse(aResponse.get_ObjectStoreGetAllResponse().cloneInfos());
|
||||
HandleResponse(
|
||||
std::move(aResponse.get_ObjectStoreGetAllResponse().cloneInfos()));
|
||||
break;
|
||||
|
||||
case RequestResponse::TObjectStoreGetAllKeysResponse:
|
||||
|
@ -2870,7 +2865,7 @@ mozilla::ipc::IPCResult BackgroundRequestChild::Recv__delete__(
|
|||
break;
|
||||
|
||||
case RequestResponse::TIndexGetResponse:
|
||||
HandleResponse(aResponse.get_IndexGetResponse().cloneInfo());
|
||||
HandleResponse(std::move(aResponse.get_IndexGetResponse().cloneInfo()));
|
||||
break;
|
||||
|
||||
case RequestResponse::TIndexGetKeyResponse:
|
||||
|
@ -2878,7 +2873,8 @@ mozilla::ipc::IPCResult BackgroundRequestChild::Recv__delete__(
|
|||
break;
|
||||
|
||||
case RequestResponse::TIndexGetAllResponse:
|
||||
HandleResponse(aResponse.get_IndexGetAllResponse().cloneInfos());
|
||||
HandleResponse(
|
||||
std::move(aResponse.get_IndexGetAllResponse().cloneInfos()));
|
||||
break;
|
||||
|
||||
case RequestResponse::TIndexGetAllKeysResponse:
|
||||
|
|
|
@ -603,10 +603,9 @@ class BackgroundRequestChild final : public BackgroundRequestChildBase,
|
|||
|
||||
void HandleResponse(const nsTArray<Key>& aResponse);
|
||||
|
||||
void HandleResponse(const SerializedStructuredCloneReadInfo& aResponse);
|
||||
void HandleResponse(SerializedStructuredCloneReadInfo&& aResponse);
|
||||
|
||||
void HandleResponse(
|
||||
const nsTArray<SerializedStructuredCloneReadInfo>& aResponse);
|
||||
void HandleResponse(nsTArray<SerializedStructuredCloneReadInfo>&& aResponse);
|
||||
|
||||
void HandleResponse(JS::Handle<JS::Value> aResponse);
|
||||
|
||||
|
@ -623,7 +622,7 @@ class BackgroundRequestChild final : public BackgroundRequestChildBase,
|
|||
// IPDL methods are only called by IPDL.
|
||||
void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
mozilla::ipc::IPCResult Recv__delete__(const RequestResponse& aResponse);
|
||||
mozilla::ipc::IPCResult Recv__delete__(RequestResponse&& aResponse);
|
||||
|
||||
mozilla::ipc::IPCResult RecvPreprocess(const PreprocessParams& aParams);
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче