Title: [220089] trunk/Source/WebCore
Revision
220089
Author
[email protected]
Date
2017-07-31 23:40:04 -0700 (Mon, 31 Jul 2017)

Log Message

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

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

No new tests because no behavior change.

Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.

* 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (220088 => 220089)


--- trunk/Source/WebCore/ChangeLog	2017-08-01 06:37:49 UTC (rev 220088)
+++ trunk/Source/WebCore/ChangeLog	2017-08-01 06:40:04 UTC (rev 220089)
@@ -1,3 +1,20 @@
+2017-07-31  Fujii Hironori  <[email protected]>
+
+        Use LazyNeverDestroyed instead of DEFINE_GLOBAL for QualifiedName
+        https://bugs.webkit.org/show_bug.cgi?id=175010
+
+        Reviewed by Alex Christensen.
+
+        No new tests because no behavior change.
+
+        Stop using DEFINE_GLOBAL hack in favor of LazyNeverDestroyed.
+
+        * 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-07-31  Matt Rajca  <[email protected]>
 
         Support quirk for letting media autoplay if the user interacted with at least one media element.

Modified: trunk/Source/WebCore/dom/DOMAllInOne.cpp (220088 => 220089)


--- trunk/Source/WebCore/dom/DOMAllInOne.cpp	2017-08-01 06:37:49 UTC (rev 220088)
+++ trunk/Source/WebCore/dom/DOMAllInOne.cpp	2017-08-01 06:40:04 UTC (rev 220089)
@@ -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 (220088 => 220089)


--- trunk/Source/WebCore/dom/QualifiedName.cpp	2017-08-01 06:37:49 UTC (rev 220088)
+++ trunk/Source/WebCore/dom/QualifiedName.cpp	2017-08-01 06:40:04 UTC (rev 220089)
@@ -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 (220088 => 220089)


--- trunk/Source/WebCore/dom/QualifiedName.h	2017-08-01 06:37:49 UTC (rev 220088)
+++ trunk/Source/WebCore/dom/QualifiedName.h	2017-08-01 06:40:04 UTC (rev 220089)
@@ -21,6 +21,7 @@
 #pragma once
 
 #include <wtf/HashTraits.h>
+#include <wtf/NeverDestroyed.h>
 #include <wtf/text/AtomicString.h>
 
 namespace WebCore {
@@ -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();
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to