Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(565)

Unified Diff: third_party/WebKit/Source/core/html/RelList.cpp

Issue 2142513003: Use initializer_lists for static WTF::HashSets. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/html/RelList.cpp
diff --git a/third_party/WebKit/Source/core/html/RelList.cpp b/third_party/WebKit/Source/core/html/RelList.cpp
index 3b4bd7d1227acbcbbf72e3128ecd72618fc78aac..a05e349c6f3c23545d03395e5c5487875aa25aa4 100644
--- a/third_party/WebKit/Source/core/html/RelList.cpp
+++ b/third_party/WebKit/Source/core/html/RelList.cpp
@@ -37,28 +37,31 @@ void RelList::setRelValues(const AtomicString& value)
m_relValues.set(value, SpaceSplitString::ShouldNotFoldCase);
}
-static RelList::SupportedTokens& supportedTokens()
+static HashSet<AtomicString>& supportedTokens()
{
- DEFINE_STATIC_LOCAL(RelList::SupportedTokens, supportedValuesMap, ());
- if (supportedValuesMap.isEmpty()) {
- supportedValuesMap.add("preload");
- supportedValuesMap.add("preconnect");
- supportedValuesMap.add("dns-prefetch");
- supportedValuesMap.add("stylesheet");
- supportedValuesMap.add("import");
- supportedValuesMap.add("icon");
- supportedValuesMap.add("alternate");
- supportedValuesMap.add("prefetch");
- supportedValuesMap.add("prerender");
- supportedValuesMap.add("next");
- supportedValuesMap.add("manifest");
- supportedValuesMap.add("apple-touch-icon");
- supportedValuesMap.add("apple-touch-icon-precomposed");
+ DEFINE_STATIC_LOCAL(HashSet<AtomicString>, tokens, ());
+
+ if (tokens.isEmpty()) {
+ tokens = {
+ "preload",
+ "preconnect",
+ "dns-prefetch",
+ "stylesheet",
+ "import",
+ "icon",
+ "alternate",
+ "prefetch",
+ "prerender",
+ "next",
+ "manifest",
+ "apple-touch-icon",
+ "apple-touch-icon-precomposed",
+ };
if (RuntimeEnabledFeatures::linkServiceWorkerEnabled())
- supportedValuesMap.add("serviceworker");
+ tokens.add("serviceworker");
}
- return supportedValuesMap;
+ return tokens;
}
bool RelList::validateTokenValue(const AtomicString& tokenValue, ExceptionState&) const
« no previous file with comments | « third_party/WebKit/Source/core/html/RelList.h ('k') | third_party/WebKit/Source/core/layout/svg/SVGResources.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698