本文整理汇总了C++中NeverDestroyed类的典型用法代码示例。如果您正苦于以下问题:C++ NeverDestroyed类的具体用法?C++ NeverDestroyed怎么用?C++ NeverDestroyed使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NeverDestroyed类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: jsTestNondeterministicNondeterministicGetterExceptionAttr
EncodedJSValue jsTestNondeterministicNondeterministicGetterExceptionAttr(ExecState* exec, JSObject* slotBase, EncodedJSValue thisValue, PropertyName)
{
UNUSED_PARAM(exec);
UNUSED_PARAM(slotBase);
UNUSED_PARAM(thisValue);
JSTestNondeterministic* castedThis = jsDynamicCast<JSTestNondeterministic*>(JSValue::decode(thisValue));
if (UNLIKELY(!castedThis)) {
if (jsDynamicCast<JSTestNondeterministicPrototype*>(slotBase))
return reportDeprecatedGetterError(*exec, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
return throwGetterTypeError(*exec, "TestNondeterministic", "nondeterministicGetterExceptionAttr");
}
ExceptionCode ec = 0;
#if ENABLE(WEB_REPLAY)
JSGlobalObject* globalObject = exec->lexicalGlobalObject();
InputCursor& cursor = globalObject->inputCursor();
static NeverDestroyed<const AtomicString> bindingName("TestNondeterministic.nondeterministicGetterExceptionAttr", AtomicString::ConstructFromLiteral);
if (cursor.isCapturing()) {
String memoizedResult = castedThis->impl().nondeterministicGetterExceptionAttr(ec);
cursor.appendInput<MemoizedDOMResult<String>>(bindingName.get().string(), memoizedResult, ec);
JSValue result = jsStringWithCache(exec, memoizedResult);
setDOMException(exec, ec);
return JSValue::encode(result);
}
if (cursor.isReplaying()) {
String memoizedResult;
MemoizedDOMResultBase* input = cursor.fetchInput<MemoizedDOMResultBase>();
if (input && input->convertTo<String>(memoizedResult)) {
JSValue result = jsStringWithCache(exec, memoizedResult);
setDOMException(exec, input->exceptionCode());
return JSValue::encode(result);
}
}
#endif
TestNondeterministic& impl = castedThis->impl();
JSValue result = jsStringWithCache(exec, impl.nondeterministicGetterExceptionAttr(ec));
setDOMException(exec, ec);
return JSValue::encode(result);
}
示例2: safeJavaScriptURL
bool XSSAuditor::eraseDangerousAttributesIfInjected(const FilterTokenRequest& request)
{
static NeverDestroyed<String> safeJavaScriptURL(ASCIILiteral("javascript:void(0)"));
bool didBlockScript = false;
for (size_t i = 0; i < request.token.attributes().size(); ++i) {
const HTMLToken::Attribute& attribute = request.token.attributes().at(i);
bool isInlineEventHandler = isNameOfInlineEventHandler(attribute.name);
// FIXME: It would be better if we didn't create a new String for every attribute in the document.
String strippedValue = stripLeadingAndTrailingHTMLSpaces(String(attribute.value));
bool valueContainsJavaScriptURL = (!isInlineEventHandler && protocolIsJavaScript(strippedValue)) || (isSemicolonSeparatedAttribute(attribute) && semicolonSeparatedValueContainsJavaScriptURL(strippedValue));
if (!isInlineEventHandler && !valueContainsJavaScriptURL)
continue;
if (!isContainedInRequest(canonicalize(snippetFromAttribute(request, attribute), TruncationStyle::ScriptLikeAttribute)))
continue;
request.token.eraseValueOfAttribute(i);
if (valueContainsJavaScriptURL)
request.token.appendToAttributeValue(i, safeJavaScriptURL.get());
didBlockScript = true;
}
return didBlockScript;
}
示例3: isSupportedAttribute
bool SVGPatternElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
SVGURIReference::addSupportedAttributes(supportedAttributes);
SVGTests::addSupportedAttributes(supportedAttributes);
SVGLangSpace::addSupportedAttributes(supportedAttributes);
SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
supportedAttributes.get().add(SVGNames::patternUnitsAttr);
supportedAttributes.get().add(SVGNames::patternContentUnitsAttr);
supportedAttributes.get().add(SVGNames::patternTransformAttr);
supportedAttributes.get().add(SVGNames::xAttr);
supportedAttributes.get().add(SVGNames::yAttr);
supportedAttributes.get().add(SVGNames::widthAttr);
supportedAttributes.get().add(SVGNames::heightAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例4: isSupportedAttribute
bool SVGFEDisplacementMapElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
supportedAttributes.get().add(SVGNames::inAttr);
supportedAttributes.get().add(SVGNames::in2Attr);
supportedAttributes.get().add(SVGNames::xChannelSelectorAttr);
supportedAttributes.get().add(SVGNames::yChannelSelectorAttr);
supportedAttributes.get().add(SVGNames::scaleAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例5: isRecognizedTagName
// FIXME: This should be removed, all callers are almost certainly wrong.
static bool isRecognizedTagName(const QualifiedName& tagName)
{
static NeverDestroyed<HashSet<AtomicStringImpl*>> tagList;
if (tagList.get().isEmpty()) {
auto* tags = HTMLNames::getHTMLTags();
for (size_t i = 0; i < HTMLNames::HTMLTagsCount; i++) {
if (*tags[i] == bgsoundTag
|| *tags[i] == commandTag
|| *tags[i] == detailsTag
|| *tags[i] == figcaptionTag
|| *tags[i] == figureTag
|| *tags[i] == summaryTag
|| *tags[i] == trackTag) {
// Even though we have atoms for these tags, we don't want to
// treat them as "recognized tags" for the purpose of parsing
// because that changes how we parse documents.
continue;
}
tagList.get().add(tags[i]->localName().impl());
}
}
return tagList.get().contains(tagName.localName().impl());
}
示例6: localeToScriptCodeForFontSelection
UScriptCode localeToScriptCodeForFontSelection(const String& locale)
{
static NeverDestroyed<LocaleScriptMap> localeScriptMap;
if (localeScriptMap.get().isEmpty()) {
for (size_t i = 0; i < sizeof(localeScriptList) / sizeof(LocaleScript); ++i)
localeScriptMap.get().set(ASCIILiteral(localeScriptList[i].locale), localeScriptList[i].script);
}
String canonicalLocale = locale.lower().replace('-', '_');
while (!canonicalLocale.isEmpty()) {
LocaleScriptMap::iterator it = localeScriptMap.get().find(canonicalLocale);
if (it != localeScriptMap.get().end())
return it->value;
size_t pos = canonicalLocale.reverseFind('_');
if (pos == notFound)
break;
UScriptCode code = scriptNameToCode(canonicalLocale.substring(pos + 1));
if (code != USCRIPT_INVALID_CODE && code != USCRIPT_UNKNOWN)
return code;
canonicalLocale = canonicalLocale.substring(0, pos);
}
return USCRIPT_COMMON;
}
示例7: simulateClick
void simulateClick(Element& element, Event* underlyingEvent, SimulatedClickMouseEventOptions mouseEventOptions, SimulatedClickVisualOptions visualOptions, SimulatedClickCreationOptions creationOptions)
{
if (element.isDisabledFormControl())
return;
static NeverDestroyed<HashSet<Element*>> elementsDispatchingSimulatedClicks;
if (!elementsDispatchingSimulatedClicks.get().add(&element).isNewEntry)
return;
if (mouseEventOptions == SendMouseOverUpDownEvents)
simulateMouseEvent(eventNames().mouseoverEvent, element, underlyingEvent, creationOptions);
if (mouseEventOptions != SendNoEvents)
simulateMouseEvent(eventNames().mousedownEvent, element, underlyingEvent, creationOptions);
element.setActive(true, visualOptions == ShowPressedLook);
if (mouseEventOptions != SendNoEvents)
simulateMouseEvent(eventNames().mouseupEvent, element, underlyingEvent, creationOptions);
element.setActive(false);
simulateMouseEvent(eventNames().clickEvent, element, underlyingEvent, creationOptions);
elementsDispatchingSimulatedClicks.get().remove(&element);
}
示例8: isSupportedAttribute
bool SVGMarkerElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
SVGLangSpace::addSupportedAttributes(supportedAttributes);
SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
SVGFitToViewBox::addSupportedAttributes(supportedAttributes);
supportedAttributes.get().add(SVGNames::markerUnitsAttr);
supportedAttributes.get().add(SVGNames::refXAttr);
supportedAttributes.get().add(SVGNames::refYAttr);
supportedAttributes.get().add(SVGNames::markerWidthAttr);
supportedAttributes.get().add(SVGNames::markerHeightAttr);
supportedAttributes.get().add(SVGNames::orientAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例9: isSupportedAttribute
bool SVGRadialGradientElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
supportedAttributes.get().add(SVGNames::cxAttr);
supportedAttributes.get().add(SVGNames::cyAttr);
supportedAttributes.get().add(SVGNames::fxAttr);
supportedAttributes.get().add(SVGNames::fyAttr);
supportedAttributes.get().add(SVGNames::rAttr);
supportedAttributes.get().add(SVGNames::frAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例10: isSupportedAttribute
bool SVGFEGaussianBlurElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
supportedAttributes.get().add(SVGNames::inAttr);
supportedAttributes.get().add(SVGNames::stdDeviationAttr);
supportedAttributes.get().add(SVGNames::edgeModeAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例11: isSupportedAttribute
bool SVGFEColorMatrixElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
supportedAttributes.get().add(SVGNames::typeAttr);
supportedAttributes.get().add(SVGNames::valuesAttr);
supportedAttributes.get().add(SVGNames::inAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例12: isSupportedAttribute
bool SVGFEMorphologyElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
supportedAttributes.get().add(SVGNames::inAttr);
supportedAttributes.get().add(SVGNames::operatorAttr);
supportedAttributes.get().add(SVGNames::radiusAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例13: isSupportedAttribute
bool SVGTextPathElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
SVGURIReference::addSupportedAttributes(supportedAttributes);
supportedAttributes.get().add(SVGNames::startOffsetAttr);
supportedAttributes.get().add(SVGNames::methodAttr);
supportedAttributes.get().add(SVGNames::spacingAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例14: isSupportedAttribute
bool SVGImageElement::isSupportedAttribute(const QualifiedName& attrName)
{
static NeverDestroyed<HashSet<QualifiedName>> supportedAttributes;
if (supportedAttributes.get().isEmpty()) {
SVGLangSpace::addSupportedAttributes(supportedAttributes);
SVGExternalResourcesRequired::addSupportedAttributes(supportedAttributes);
SVGURIReference::addSupportedAttributes(supportedAttributes);
supportedAttributes.get().add(SVGNames::xAttr);
supportedAttributes.get().add(SVGNames::yAttr);
supportedAttributes.get().add(SVGNames::widthAttr);
supportedAttributes.get().add(SVGNames::heightAttr);
supportedAttributes.get().add(SVGNames::preserveAspectRatioAttr);
}
return supportedAttributes.get().contains<SVGAttributeHashTranslator>(attrName);
}
示例15: chainableResourceTags
static HashSet<AtomicString>& chainableResourceTags()
{
static NeverDestroyed<HashSet<AtomicString>> s_tagList;
if (s_tagList.get().isEmpty()) {
s_tagList.get().add(SVGNames::linearGradientTag.localName());
s_tagList.get().add(SVGNames::filterTag.localName());
s_tagList.get().add(SVGNames::patternTag.localName());
s_tagList.get().add(SVGNames::radialGradientTag.localName());
}
return s_tagList;
}