Title: [220131] trunk/Source
Revision
220131
Author
[email protected]
Date
2017-08-02 09:46:59 -0700 (Wed, 02 Aug 2017)

Log Message

Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
https://bugs.webkit.org/show_bug.cgi?id=175010
<rdar://problem/33647818>

Patch by Fujii Hironori <[email protected]> on 2017-08-02
Reviewed by Alex Christensen.

Source/WebCore:

No new tests because no behavior change.

Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.

* contentextensions/ContentExtensionParser.cpp:
(WebCore::ContentExtensions::isValidCSSSelector):
Call QualifiedName::init().
* dom/DOMAllInOne.cpp: Remove the warning. Include QualifiedName.cpp.
* dom/QualifiedName.cpp:
(WebCore::QualifiedName::init): Call LazyNeverDestroyed::construct
instead of placement new.
* dom/QualifiedName.h: Use LazyNeverDestroyed.

Source/WebKit:

* UIProcess/API/APIContentRuleListStore.cpp:
(API::ContentRuleListStore::compileContentRuleList):
Call QualifiedName::init().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220130 => 220131)


--- trunk/Source/WebCore/ChangeLog	2017-08-02 15:36:24 UTC (rev 220130)
+++ trunk/Source/WebCore/ChangeLog	2017-08-02 16:46:59 UTC (rev 220131)
@@ -1,3 +1,24 @@
+2017-08-02  Fujii Hironori  <[email protected]>
+
+        Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
+        https://bugs.webkit.org/show_bug.cgi?id=175010
+        <rdar://problem/33647818>
+
+        Reviewed by Alex Christensen.
+
+        No new tests because no behavior change.
+
+        Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
+
+        * contentextensions/ContentExtensionParser.cpp:
+        (WebCore::ContentExtensions::isValidCSSSelector):
+        Call QualifiedName::init().
+        * dom/DOMAllInOne.cpp: Remove the warning. Include QualifiedName.cpp.
+        * dom/QualifiedName.cpp:
+        (WebCore::QualifiedName::init): Call LazyNeverDestroyed::construct
+        instead of placement new.
+        * dom/QualifiedName.h: Use LazyNeverDestroyed.
+
 2017-08-01  Joseph Pecoraro  <[email protected]>
 
         CFString leak dragging an image - allocation under PlatformPasteboard::writeObjectRepresentations

Modified: trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp (220130 => 220131)


--- trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp	2017-08-02 15:36:24 UTC (rev 220130)
+++ trunk/Source/WebCore/contentextensions/ContentExtensionParser.cpp	2017-08-02 16:46:59 UTC (rev 220131)
@@ -234,6 +234,7 @@
 bool isValidCSSSelector(const String& selector)
 {
     AtomicString::init();
+    QualifiedName::init();
     CSSParserContext context(HTMLQuirksMode);
     CSSParser parser(context);
     CSSSelectorList selectorList;

Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (220130 => 220131)


--- trunk/Source/WebCore/dom/DOMAllInOne.cpp	2017-08-02 15:36:24 UTC (rev 220130)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp	2017-08-02 16:46:59 UTC (rev 220131)
@@ -118,9 +118,7 @@
 #include "ProcessingInstruction.cpp"
 #include "ProgressEvent.cpp"
 #include "PseudoElement.cpp"
-// Build error if adding QualifiedName.cpp to DOMAllInOne.cpp
-// https://bugs.webkit.org/show_bug.cgi?id=146586
-// #include "QualifiedName.cpp"
+#include "QualifiedName.cpp"
 #include "RadioButtonGroups.cpp"
 #include "Range.cpp"
 #include "RejectedPromiseTracker.cpp"

Modified: trunk/Source/WebCore/dom/QualifiedName.cpp (220130 => 220131)


--- trunk/Source/WebCore/dom/QualifiedName.cpp	2017-08-02 15:36:24 UTC (rev 220130)
+++ trunk/Source/WebCore/dom/QualifiedName.cpp	2017-08-02 16:46:59 UTC (rev 220131)
@@ -18,19 +18,11 @@
  */
 
 #include "config.h"
+#include "QualifiedName.h"
 
-#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
-#define WEBCORE_QUALIFIEDNAME_HIDE_GLOBALS 1
-#else
-#define QNAME_DEFAULT_CONSTRUCTOR
-#endif
-
-#include "QualifiedName.h"
 #include "QualifiedNameCache.h"
 #include "ThreadGlobalData.h"
 #include <wtf/Assertions.h>
-#include <wtf/NeverDestroyed.h>
-#include <wtf/StaticConstructors.h>
 
 namespace WebCore {
 
@@ -45,7 +37,7 @@
 }
 
 // Global init routines
-DEFINE_GLOBAL(QualifiedName, anyName, nullAtom(), starAtom(), starAtom())
+LazyNeverDestroyed<const QualifiedName> anyName;
 
 void QualifiedName::init()
 {
@@ -53,9 +45,8 @@
     if (initialized)
         return;
 
-    // Use placement new to initialize the globals.
     AtomicString::init();
-    new (NotNull, (void*)&anyName) QualifiedName(nullAtom(), starAtom(), starAtom());
+    anyName.construct(nullAtom(), starAtom(), starAtom());
     initialized = true;
 }
 

Modified: trunk/Source/WebCore/dom/QualifiedName.h (220130 => 220131)


--- trunk/Source/WebCore/dom/QualifiedName.h	2017-08-02 15:36:24 UTC (rev 220130)
+++ trunk/Source/WebCore/dom/QualifiedName.h	2017-08-02 16:46:59 UTC (rev 220131)
@@ -21,6 +21,7 @@
 #pragma once
 
 #include <wtf/HashTraits.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
@@ -96,7 +97,7 @@
 #endif
     
     // Init routine for globals
-    static void init();
+    WEBCORE_EXPORT static void init();
 
 private:
     static QualifiedNameImpl* hashTableDeletedValue() { return RefPtr<QualifiedNameImpl>::hashTableDeletedValue(); }
@@ -104,10 +105,8 @@
     RefPtr<QualifiedNameImpl> m_impl;
 };
 
-#ifndef WEBCORE_QUALIFIEDNAME_HIDE_GLOBALS
-extern const QualifiedName anyName;
+extern LazyNeverDestroyed<const QualifiedName> anyName;
 inline const QualifiedName& anyQName() { return anyName; }
-#endif
 
 const QualifiedName& nullQName();
 

Modified: trunk/Source/WebKit/ChangeLog (220130 => 220131)


--- trunk/Source/WebKit/ChangeLog	2017-08-02 15:36:24 UTC (rev 220130)
+++ trunk/Source/WebKit/ChangeLog	2017-08-02 16:46:59 UTC (rev 220131)
@@ -1,3 +1,15 @@
+2017-08-02  Fujii Hironori  <[email protected]>
+
+        Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
+        https://bugs.webkit.org/show_bug.cgi?id=175010
+        <rdar://problem/33647818>
+
+        Reviewed by Alex Christensen.
+
+        * UIProcess/API/APIContentRuleListStore.cpp:
+        (API::ContentRuleListStore::compileContentRuleList):
+        Call QualifiedName::init().
+
 2017-08-01  Chris Dumez  <[email protected]>
 
         Add initial support for navigator.sendBeacon

Modified: trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp (220130 => 220131)


--- trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-08-02 15:36:24 UTC (rev 220130)
+++ trunk/Source/WebKit/UIProcess/API/APIContentRuleListStore.cpp	2017-08-02 16:46:59 UTC (rev 220131)
@@ -35,6 +35,7 @@
 #include "WebCompiledContentRuleList.h"
 #include <WebCore/ContentExtensionCompiler.h>
 #include <WebCore/ContentExtensionError.h>
+#include <WebCore/QualifiedName.h>
 #include <string>
 #include <wtf/NeverDestroyed.h>
 #include <wtf/RunLoop.h>
@@ -427,6 +428,7 @@
 void ContentRuleListStore::compileContentRuleList(const WTF::String& identifier, WTF::String&& json, Function<void(RefPtr<API::ContentRuleList>, std::error_code)> completionHandler)
 {
     AtomicString::init();
+    WebCore::QualifiedName::init();
     m_compileQueue->dispatch([protectedThis = makeRef(*this), identifier = identifier.isolatedCopy(), legacyFilename = m_legacyFilename, json = json.isolatedCopy(), storePath = m_storePath.isolatedCopy(), completionHandler = WTFMove(completionHandler)] () mutable {
         auto path = constructedPath(storePath, identifier, legacyFilename);
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to