Title: [276499] trunk/Source/WebCore
Revision
276499
Author
[email protected]
Date
2021-04-23 08:40:24 -0700 (Fri, 23 Apr 2021)

Log Message

Improve HashTableDeletedValue of ServiceWorkerRegistrationKey
https://bugs.webkit.org/show_bug.cgi?id=224975

Patch by Michael Catanzaro <[email protected]> on 2021-04-23
Reviewed by Chris Dumez.

We construct only the SecurityOriginData, no need to construct a full
ServiceWorkerRegistrationKey or URL. No behavior changes.

* workers/service/ServiceWorkerRegistrationKey.h:
(WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
(WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
(WebCore::ServiceWorkerRegistrationKey::isHashTableDeletedValue const): Deleted.
(WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (276498 => 276499)


--- trunk/Source/WebCore/ChangeLog	2021-04-23 15:16:30 UTC (rev 276498)
+++ trunk/Source/WebCore/ChangeLog	2021-04-23 15:40:24 UTC (rev 276499)
@@ -1,3 +1,19 @@
+2021-04-23  Michael Catanzaro  <[email protected]>
+
+        Improve HashTableDeletedValue of ServiceWorkerRegistrationKey
+        https://bugs.webkit.org/show_bug.cgi?id=224975
+
+        Reviewed by Chris Dumez.
+
+        We construct only the SecurityOriginData, no need to construct a full
+        ServiceWorkerRegistrationKey or URL. No behavior changes.
+
+        * workers/service/ServiceWorkerRegistrationKey.h:
+        (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::constructDeletedValue):
+        (WTF::HashTraits<WebCore::ServiceWorkerRegistrationKey>::isDeletedValue):
+        (WebCore::ServiceWorkerRegistrationKey::isHashTableDeletedValue const): Deleted.
+        (WebCore::ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey): Deleted.
+
 2021-04-23  Youenn Fablet  <[email protected]>
 
         Handle rotation correctly in WebRTC GPUProcess rendering pipeline

Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h (276498 => 276499)


--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h	2021-04-23 15:16:30 UTC (rev 276498)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistrationKey.h	2021-04-23 15:40:24 UTC (rev 276499)
@@ -35,7 +35,6 @@
 class ServiceWorkerRegistrationKey {
 public:
     ServiceWorkerRegistrationKey() = default;
-    explicit ServiceWorkerRegistrationKey(WTF::HashTableDeletedValueType);
     WEBCORE_EXPORT ServiceWorkerRegistrationKey(SecurityOriginData&& topOrigin, URL&& scope);
 
     static ServiceWorkerRegistrationKey emptyKey();
@@ -66,18 +65,13 @@
     String loggingString() const;
 #endif
 
-    bool isHashTableDeletedValue() const { return m_topOrigin.isHashTableDeletedValue(); }
+private:
+    friend struct HashTraits<ServiceWorkerRegistrationKey>;
 
-private:
     SecurityOriginData m_topOrigin;
     URL m_scope;
 };
 
-inline ServiceWorkerRegistrationKey::ServiceWorkerRegistrationKey(WTF::HashTableDeletedValueType)
-    : m_topOrigin(WTF::HashTableDeletedValue)
-{
-}
-
 template<class Encoder>
 void ServiceWorkerRegistrationKey::encode(Encoder& encoder) const
 {
@@ -114,8 +108,8 @@
 template<> struct HashTraits<WebCore::ServiceWorkerRegistrationKey> : GenericHashTraits<WebCore::ServiceWorkerRegistrationKey> {
     static WebCore::ServiceWorkerRegistrationKey emptyValue() { return WebCore::ServiceWorkerRegistrationKey::emptyKey(); }
 
-    static void constructDeletedValue(WebCore::ServiceWorkerRegistrationKey& slot) { new (NotNull, &slot) WebCore::ServiceWorkerRegistrationKey(HashTableDeletedValue); }
-    static bool isDeletedValue(const WebCore::ServiceWorkerRegistrationKey& slot) { return slot.isHashTableDeletedValue(); }
+    static void constructDeletedValue(WebCore::ServiceWorkerRegistrationKey& slot) { new (NotNull, &slot.m_topOrigin) WebCore::SecurityOriginData(HashTableDeletedValue); }
+    static bool isDeletedValue(const WebCore::ServiceWorkerRegistrationKey& slot) { return slot.m_topOrigin.isHashTableDeletedValue(); }
 };
 
 template<> struct DefaultHash<WebCore::ServiceWorkerRegistrationKey> : ServiceWorkerRegistrationKeyHash { };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to