зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1773088 - Part 3: Remove StealFromAndBuildClonedMessageData, r=asuth
This API should no longer be necessary, as there's nothing tied to a specific actor in the serialized IPCBlob form any longer, so the value can be directly transferred without special handling or re-serialization. Differential Revision: https://phabricator.services.mozilla.com/D148533
This commit is contained in:
Родитель
7eef772214
Коммит
6c2d8c7bf5
|
@ -32,30 +32,6 @@ ServiceWorkerCloneData::ServiceWorkerCloneData()
|
|||
MOZ_DIAGNOSTIC_ASSERT(mEventTarget);
|
||||
}
|
||||
|
||||
bool ServiceWorkerCloneData::StealFromAndBuildClonedMessageData(
|
||||
ClonedOrErrorMessageData& aFromClonedData,
|
||||
ClonedOrErrorMessageData& aToClonedData) {
|
||||
if (aFromClonedData.type() == ClonedOrErrorMessageData::TErrorMessageData) {
|
||||
mIsErrorMessageData = true;
|
||||
aToClonedData = ErrorMessageData();
|
||||
return true;
|
||||
}
|
||||
|
||||
MOZ_DIAGNOSTIC_ASSERT(aFromClonedData.type() ==
|
||||
ClonedOrErrorMessageData::TClonedMessageData);
|
||||
|
||||
StructuredCloneData::StealFromClonedMessageData(aFromClonedData);
|
||||
|
||||
ClonedMessageData messageData;
|
||||
if (!StructuredCloneData::BuildClonedMessageData(messageData)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aToClonedData = std::move(messageData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ServiceWorkerCloneData::BuildClonedMessageData(
|
||||
ClonedOrErrorMessageData& aClonedData) {
|
||||
if (IsErrorMessageData()) {
|
||||
|
|
|
@ -54,13 +54,6 @@ class ServiceWorkerCloneData final : public ipc::StructuredCloneData {
|
|||
public:
|
||||
ServiceWorkerCloneData();
|
||||
|
||||
// FIXME: Now that there's nothing in ClonedOrErrorMessageData tied to a
|
||||
// specific actor, it should be possible to just pass on the same cloned data,
|
||||
// which means this method is effectively an expensive no-op.
|
||||
bool StealFromAndBuildClonedMessageData(
|
||||
ClonedOrErrorMessageData& aFromClonedData,
|
||||
ClonedOrErrorMessageData& aToClonedData);
|
||||
|
||||
bool BuildClonedMessageData(ClonedOrErrorMessageData& aClonedData);
|
||||
|
||||
void CopyFromClonedMessageData(const ClonedOrErrorMessageData& aClonedData);
|
||||
|
|
|
@ -464,10 +464,9 @@ bool RemoteWorkerController::PendingServiceWorkerOp::MaybeStart(
|
|||
return false;
|
||||
}
|
||||
|
||||
const auto send = [this, &aOwner](const ServiceWorkerOpArgs& args) {
|
||||
MaybeReportServiceWorkerShutdownProgress(args);
|
||||
MaybeReportServiceWorkerShutdownProgress(mArgs);
|
||||
|
||||
aOwner->mActor->SendExecServiceWorkerOp(args)->Then(
|
||||
aOwner->mActor->SendExecServiceWorkerOp(mArgs)->Then(
|
||||
GetCurrentSerialEventTarget(), __func__,
|
||||
[promise = std::move(mPromise)](
|
||||
PRemoteWorkerParent::ExecServiceWorkerOpPromise::
|
||||
|
@ -479,27 +478,6 @@ bool RemoteWorkerController::PendingServiceWorkerOp::MaybeStart(
|
|||
|
||||
promise->Resolve(std::move(aResult.ResolveValue()), __func__);
|
||||
});
|
||||
};
|
||||
|
||||
if (mArgs.type() == ServiceWorkerOpArgs::TServiceWorkerMessageEventOpArgs) {
|
||||
auto& args = mArgs.get_ServiceWorkerMessageEventOpArgs();
|
||||
|
||||
ServiceWorkerMessageEventOpArgs copyArgs;
|
||||
copyArgs.clientInfoAndState() = std::move(args.clientInfoAndState());
|
||||
|
||||
RefPtr<ServiceWorkerCloneData> copyData = new ServiceWorkerCloneData();
|
||||
if (!copyData->StealFromAndBuildClonedMessageData(args.clonedData(),
|
||||
copyArgs.clonedData())) {
|
||||
mPromise->Reject(NS_ERROR_DOM_DATA_CLONE_ERR, __func__);
|
||||
mPromise = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
// copyArgs depends on mArgs due to BuildClonedMessageData.
|
||||
send(std::move(copyArgs));
|
||||
} else {
|
||||
send(mArgs);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче