-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Markable instead of std::optional when storing UUIDs in structs #9433
Use Markable instead of std::optional when storing UUIDs in structs #9433
Conversation
@@ -117,7 +117,7 @@ std::optional<NetworkSessionCreationParameters> NetworkSessionCreationParameters | |||
if (!sessionID) | |||
return std::nullopt; | |||
|
|||
std::optional<std::optional<UUID>> dataStoreIdentifier; | |||
std::optional<Markable<UUID>> dataStoreIdentifier; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can just decode it into std::optional
, and then we can assign it to markable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is more correct. I really ought to just make it NetworkSessionCreationParameters.serialization.in which would generate this, but that should probably be a separate PR.
@@ -50,7 +51,7 @@ class WebExtensionControllerConfiguration : public API::ObjectImpl<API::Object:: | |||
explicit WebExtensionControllerConfiguration(IsPersistent); | |||
explicit WebExtensionControllerConfiguration(const UUID&); | |||
|
|||
std::optional<UUID> identifier() const { return m_identifier; } | |||
Markable<UUID> identifier() const { return m_identifier; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can continue returning std::optional if it is better since Markable <-> std::optional conversion can happen implicitly. So, I would recommend using std::optional usually, and using Markable only when we store it to the member.
@@ -59,7 +60,7 @@ class WebsiteDataStoreConfiguration : public API::ObjectImpl<API::Object::Type:: | |||
Ref<WebsiteDataStoreConfiguration> copy() const; | |||
|
|||
bool isPersistent() const { return m_isPersistent == IsPersistent::Yes; } | |||
std::optional<UUID> identifier() const { return m_identifier; } | |||
Markable<UUID> identifier() const { return m_identifier; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
@@ -66,7 +66,7 @@ class ClientConnection : public RefCounted<ClientConnection>, public CanMakeWeak | |||
bool hostAppHasPushInjectEntitlement(); | |||
|
|||
const String& pushPartitionString() const { return m_pushPartitionString; } | |||
std::optional<UUID> dataStoreIdentifier() const { return m_dataStoreIdentifier; } | |||
Markable<UUID> dataStoreIdentifier() const { return m_dataStoreIdentifier; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
@@ -529,7 +529,7 @@ async function disableShowNotifications() | |||
TestWebKitAPI::Util::run(&ready); | |||
} | |||
|
|||
const std::optional<UUID>& dataStoreIdentifier() { return m_dataStoreIdentifier; } | |||
const Markable<UUID>& dataStoreIdentifier() { return m_dataStoreIdentifier; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
12c32e8
to
b2b2f97
Compare
EWS run on current version of this PR (hash b2b2f97)
|
https://bugs.webkit.org/show_bug.cgi?id=251485 rdar://104902597 Reviewed by Yusuke Suzuki. This removes unnecessary and unused padding bytes, decreasing memory use. * Source/WTF/wtf/UUID.h: (WTF::UUID::MarkableTraits::isEmptyValue): (WTF::UUID::MarkableTraits::emptyValue): * Source/WebCore/Modules/push-api/PushSubscriptionIdentifier.h: * Source/WebKit/NetworkProcess/NetworkSession.h: * Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp: (WebKit::NetworkSessionCreationParameters::decode): * Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h: * Source/WebKit/Platform/IPC/DaemonCoders.h: * Source/WebKit/Shared/WebPushDaemonConnectionConfiguration.h: * Source/WebKit/Shared/WebPushDaemonConnectionConfiguration.serialization.in: * Source/WebKit/UIProcess/Extensions/WebExtensionControllerConfiguration.h: (WebKit::WebExtensionControllerConfiguration::identifier const): * Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: (WebKit::WebsiteDataStoreConfiguration::identifier const): * Source/WebKit/webpushd/PushClientConnection.h: (WebPushD::ClientConnection::dataStoreIdentifier const): * Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm: Canonical link: https://commits.webkit.org/259665@main
b2b2f97
to
4c52b06
Compare
Committed 259665@main (4c52b06): https://commits.webkit.org/259665@main Reviewed commits have been landed. Closing PR #9433 and removing active labels. |
4c52b06
b2b2f97
π π§ͺ winπ gtkπ wincairoπ§ͺ ios-wk2π§ͺ api-macπ§ͺ gtk-wk2π§ͺ api-iosπ§ͺ api-gtkπ π§ͺ jscπ§ͺ mac-wk2π tv-simπ§ͺ mac-AS-debug-wk2π watch-sim