Improve use of NeverDestroyed
[WebKit-https.git] / Source / WebCore / svg / SVGTextContentElement.cpp
index 12f1dcb..a65ee88 100644 (file)
@@ -190,13 +190,13 @@ ExceptionOr<void> SVGTextContentElement::selectSubString(unsigned charnum, unsig
 
 bool SVGTextContentElement::isSupportedAttribute(const QualifiedName& attrName)
 {
-    static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
-    if (supportedAttributes.get().isEmpty()) {
-        SVGLangSpace::addSupportedAttributes(supportedAttributes);
-        SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
-        supportedAttributes.get().add(SVGNames::lengthAdjustAttr);
-        supportedAttributes.get().add(SVGNames::textLengthAttr);
-    }
+    static const auto supportedAttributes = makeNeverDestroyed([] {
+        HashSet<QualifiedName> set;
+        SVGLangSpace::addSupportedAttributes(set);
+        SVGExternalResourcesRequired::addSupportedAttributes(set);
+        set.add({ SVGNames::lengthAdjustAttr, SVGNames::textLengthAttr });
+        return set;
+    }());
     return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
 }