https://bugs.webkit.org/show_bug.cgi?id=175010
<rdar://problem/
33647818>
Patch by Fujii Hironori <Hironori.Fujii@sony.com> 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().
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220131
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-08-02 Fujii Hironori <Hironori.Fujii@sony.com>
+
+ 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 <pecoraro@apple.com>
CFString leak dragging an image - allocation under PlatformPasteboard::writeObjectRepresentations
bool isValidCSSSelector(const String& selector)
{
AtomicString::init();
+ QualifiedName::init();
CSSParserContext context(HTMLQuirksMode);
CSSParser parser(context);
CSSSelectorList selectorList;
#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"
*/
#include "config.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 {
}
// Global init routines
-DEFINE_GLOBAL(QualifiedName, anyName, nullAtom(), starAtom(), starAtom())
+LazyNeverDestroyed<const QualifiedName> anyName;
void QualifiedName::init()
{
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;
}
#pragma once
#include <wtf/HashTraits.h>
+#include <wtf/NeverDestroyed.h>
#include <wtf/text/AtomicString.h>
namespace WebCore {
#endif
// Init routine for globals
- static void init();
+ WEBCORE_EXPORT static void init();
private:
static QualifiedNameImpl* hashTableDeletedValue() { return RefPtr<QualifiedNameImpl>::hashTableDeletedValue(); }
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();
+2017-08-02 Fujii Hironori <Hironori.Fujii@sony.com>
+
+ 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 <cdumez@apple.com>
Add initial support for navigator.sendBeacon
#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>
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);