Skip to content

Commit

Permalink
Generate serialization for WebCore::PaymentSessionError
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=267744
rdar://121226874

Reviewed by Alex Christensen.

* Source/WebCore/Modules/applepay/PaymentSessionError.h:
* Source/WebCore/Modules/applepay/cocoa/PaymentSessionErrorCocoa.mm:
(WebCore::PaymentSessionError::platformError const):
* Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::PaymentSessionError>::encode): Deleted.
(IPC::ArgumentCoder<WebCore::PaymentSessionError>::decode): Deleted.
* Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.serialization.in:
* Source/WebKit/Shared/WebCoreArgumentCoders.h:

Canonical link: https://commits.webkit.org/273511@main
  • Loading branch information
sheeparegreat authored and achristensen07 committed Jan 25, 2024
1 parent a98855c commit 7abb62b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Source/WebCore/Modules/applepay/PaymentSessionError.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class WEBCORE_EXPORT PaymentSessionError {
PaymentSessionError(RetainPtr<NSError>&&);

ApplePaySessionError sessionError() const;
NSError *platformError() const;
RetainPtr<NSError> platformError() const;

private:
ApplePaySessionError unknownError() const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@
return unknownError();
}

NSError *PaymentSessionError::platformError() const
RetainPtr<NSError> PaymentSessionError::platformError() const
{
return m_platformError.get();
return m_platformError;
}

ApplePaySessionError PaymentSessionError::unknownError() const
Expand Down
14 changes: 0 additions & 14 deletions Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -382,20 +382,6 @@
return true;
}

void ArgumentCoder<WebCore::PaymentSessionError>::encode(Encoder& encoder, const WebCore::PaymentSessionError& error)
{
encoder << error.platformError();
}

std::optional<WebCore::PaymentSessionError> ArgumentCoder<WebCore::PaymentSessionError>::decode(Decoder& decoder)
{
auto platformError = decoder.decode<RetainPtr<NSError>>();
if (!platformError)
return std::nullopt;

return { WTFMove(*platformError) };
}

#endif // ENABLE(APPLEPAY)

void ArgumentCoder<WebCore::Font>::encodePlatformData(Encoder& encoder, const WebCore::Font& font)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ enum class WebCore::ApplePaySessionPaymentRequestShippingType : uint8_t {
ServicePickup,
};

class WebCore::PaymentSessionError {
[SecureCodingAllowed=[NSError.class]] RetainPtr<NSError> platformError();
};

headers: <pal/cocoa/PassKitSoftLink.h>
class WebCore::PaymentMethod {
[Precondition='PAL::isPassKitCoreFrameworkAvailable()', SecureCodingAllowed=[PAL::getPKPaymentMethodClass()], Validator='m_pkPaymentMethod'] RetainPtr<PKPaymentMethod> m_pkPaymentMethod;
Expand Down
5 changes: 0 additions & 5 deletions Source/WebKit/Shared/WebCoreArgumentCoders.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,6 @@ template<> struct ArgumentCoder<WebCore::ApplePaySessionPaymentRequest::Merchant
static WARN_UNUSED_RETURN bool decode(Decoder&, WebCore::ApplePaySessionPaymentRequest::MerchantCapabilities&);
};

template<> struct ArgumentCoder<WebCore::PaymentSessionError> {
static void encode(Encoder&, const WebCore::PaymentSessionError&);
static std::optional<WebCore::PaymentSessionError> decode(Decoder&);
};

#endif

#if ENABLE(VIDEO)
Expand Down

0 comments on commit 7abb62b

Please sign in to comment.