Title: [289380] trunk/Source/WebKit
Revision
289380
Author
[email protected]
Date
2022-02-08 09:03:38 -0800 (Tue, 08 Feb 2022)

Log Message

Reduce allocations and increase thread safety of constructedPath
https://bugs.webkit.org/show_bug.cgi?id=236286
<rdar://86904276>

Patch by Alex Christensen <[email protected]> on 2022-02-08
Reviewed by Chris Dumez.

* UIProcess/API/APIContentRuleListStore.cpp:
(API::constructedPathPrefix):
(API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (289379 => 289380)


--- trunk/Source/WebKit/ChangeLog	2022-02-08 16:57:43 UTC (rev 289379)
+++ trunk/Source/WebKit/ChangeLog	2022-02-08 17:03:38 UTC (rev 289380)
@@ -1,3 +1,15 @@
+2022-02-08  Alex Christensen  <[email protected]>
+
+        Reduce allocations and increase thread safety of constructedPath
+        https://bugs.webkit.org/show_bug.cgi?id=236286
+        <rdar://86904276>
+
+        Reviewed by Chris Dumez.
+
+        * UIProcess/API/APIContentRuleListStore.cpp:
+        (API::constructedPathPrefix):
+        (API::ContentRuleListStore::getAvailableContentRuleListIdentifiers):
+
 2022-02-08  Simon Fraser  <[email protected]>
 
         Rename ImageBufferShareableIOSurfaceBackend to ImageBufferRemoteIOSurfaceBackend

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp (289379 => 289380)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2022-02-08 16:57:43 UTC (rev 289379)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2022-02-08 17:03:38 UTC (rev 289380)
@@ -80,10 +80,10 @@
 ContentRuleListStore::~ContentRuleListStore() = default;
 
 // FIXME: Remove legacyFilename in 2022 or 2023 after users have had a chance to run the updating logic.
-static const WTF::String& constructedPathPrefix(bool legacyFilename)
+static const char* constructedPathPrefix(bool legacyFilename)
 {
-    static NeverDestroyed<WTF::String> prefix("ContentRuleList-");
-    static NeverDestroyed<WTF::String> legacyPrefix("ContentExtension-");
+    static auto* prefix("ContentRuleList-");
+    static auto* legacyPrefix("ContentExtension-");
     if (legacyFilename)
         return legacyPrefix;
     return prefix;
@@ -521,9 +521,9 @@
     ASSERT(RunLoop::isMain());
     m_readQueue->dispatch([protectedThis = Ref { *this }, storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)]() mutable {
         auto prefix = constructedPathPrefix(false /*legacy*/);
-        auto prefixLength = prefix.length();
+        auto prefixLength = strlen(prefix);
         auto legacyPrefix = constructedPathPrefix(true /*legacy*/);
-        auto legacyPrefixLength = legacyPrefix.length();
+        auto legacyPrefixLength = strlen(legacyPrefix);
 
         Vector<WTF::String> identifiers;
         for (auto& fileName : listDirectory(storePath)) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to