Title: [273944] trunk/Source/WebCore
Revision
273944
Author
[email protected]
Date
2021-03-04 20:36:13 -0800 (Thu, 04 Mar 2021)

Log Message

Make RegistrableDomain() private constructor take the String as an rvalue reference
https://bugs.webkit.org/show_bug.cgi?id=222767

Reviewed by Alex Christensen.

Make RegistrableDomain() private constructor take the String as an rvalue reference.
Most call sites have an rvalue reference and it reduces ref counting churn this way.

* platform/RegistrableDomain.h:
(WebCore::RegistrableDomain::uncheckedCreateFromRegistrableDomainString):
(WebCore::RegistrableDomain::uncheckedCreateFromHost):
(WebCore::RegistrableDomain::RegistrableDomain):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (273943 => 273944)


--- trunk/Source/WebCore/ChangeLog	2021-03-05 04:36:09 UTC (rev 273943)
+++ trunk/Source/WebCore/ChangeLog	2021-03-05 04:36:13 UTC (rev 273944)
@@ -1,3 +1,18 @@
+2021-03-04  Chris Dumez  <[email protected]>
+
+        Make RegistrableDomain() private constructor take the String as an rvalue reference
+        https://bugs.webkit.org/show_bug.cgi?id=222767
+
+        Reviewed by Alex Christensen.
+
+        Make RegistrableDomain() private constructor take the String as an rvalue reference.
+        Most call sites have an rvalue reference and it reduces ref counting churn this way.
+
+        * platform/RegistrableDomain.h:
+        (WebCore::RegistrableDomain::uncheckedCreateFromRegistrableDomainString):
+        (WebCore::RegistrableDomain::uncheckedCreateFromHost):
+        (WebCore::RegistrableDomain::RegistrableDomain):
+
 2021-03-04  Devin Rousso  <[email protected]>
 
         [Payment Request] remove some unnecessary WebKitAdditions hooks

Modified: trunk/Source/WebCore/platform/RegistrableDomain.h (273943 => 273944)


--- trunk/Source/WebCore/platform/RegistrableDomain.h	2021-03-05 04:36:09 UTC (rev 273943)
+++ trunk/Source/WebCore/platform/RegistrableDomain.h	2021-03-05 04:36:13 UTC (rev 273944)
@@ -81,7 +81,7 @@
 
     static RegistrableDomain uncheckedCreateFromRegistrableDomainString(const String& domain)
     {
-        return RegistrableDomain { domain };
+        return RegistrableDomain { String { domain } };
     }
     
     static RegistrableDomain uncheckedCreateFromHost(const String& host)
@@ -90,7 +90,7 @@
         auto registrableDomain = topPrivatelyControlledDomain(host);
         if (registrableDomain.isEmpty())
             return uncheckedCreateFromRegistrableDomainString(host);
-        return RegistrableDomain { registrableDomain };
+        return RegistrableDomain { WTFMove(registrableDomain) };
 #else
         return uncheckedCreateFromRegistrableDomainString(host);
 #endif
@@ -102,8 +102,8 @@
 protected:
 
 private:
-    explicit RegistrableDomain(const String& domain)
-        : m_registrableDomain { domain.isEmpty() ? "nullOrigin"_s : domain }
+    explicit RegistrableDomain(String&& domain)
+        : m_registrableDomain { domain.isEmpty() ? "nullOrigin"_s : WTFMove(domain) }
     {
     }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to