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

Unified Diff: Source/core/html/parser/HTMLIdentifier.cpp

Issue 51983003: Stop using static arrays for *Tags / *Attrs (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve generated code Created 7 years, 2 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: Source/core/html/parser/HTMLIdentifier.cpp
diff --git a/Source/core/html/parser/HTMLIdentifier.cpp b/Source/core/html/parser/HTMLIdentifier.cpp
index 5a77dd0db1aa8913793da6ad5e5cdec74b954900..4656afacc697518deb05c278940998da8acd1855 100644
--- a/Source/core/html/parser/HTMLIdentifier.cpp
+++ b/Source/core/html/parser/HTMLIdentifier.cpp
@@ -76,10 +76,6 @@ StringImpl* HTMLIdentifier::findIfKnown(const UChar* characters, unsigned length
return it->value;
}
-const unsigned kHTMLNamesIndexOffset = 0;
Inactive 2013/10/30 18:35:36 These constants were passed to HTMLIdentifier::add
abarth-chromium 2013/10/30 19:30:11 Yeah, this was old tech before we had thread-safe
-const unsigned kHTMLAttrsIndexOffset = 1000;
-COMPILE_ASSERT(kHTMLAttrsIndexOffset > HTMLTagsCount, kHTMLAttrsIndexOffset_should_be_larger_than_HTMLTagsCount);
-
const String& HTMLIdentifier::asString() const
{
ASSERT(isMainThread());
@@ -91,10 +87,11 @@ const StringImpl* HTMLIdentifier::asStringImpl() const
return m_string.impl();
}
-void HTMLIdentifier::addNames(const QualifiedName* const* names, unsigned namesCount, unsigned indexOffset)
+void HTMLIdentifier::addNames(const Vector<const QualifiedName*>& names)
{
IdentifierTable& table = identifierTable();
- for (unsigned i = 0; i < namesCount; ++i) {
+ size_t namesCount = names.size();
+ for (size_t i = 0; i < namesCount; ++i) {
StringImpl* name = names[i]->localName().impl();
unsigned hash = name->hash();
IdentifierTable::AddResult addResult = table.add(hash, name);
@@ -118,8 +115,12 @@ void HTMLIdentifier::init()
isInitialized = true;
// FIXME: We should atomize small whitespace (\n, \n\n, etc.)
- addNames(getHTMLTags(), HTMLTagsCount, kHTMLNamesIndexOffset);
- addNames(getHTMLAttrs(), HTMLAttrsCount, kHTMLAttrsIndexOffset);
+ Vector<const QualifiedName*> HTMLTags;
+ getHTMLTags(HTMLTags);
+ addNames(HTMLTags);
+ Vector<const QualifiedName*> HTMLAttrs;
+ getHTMLAttrs(HTMLAttrs);
+ addNames(HTMLAttrs);
}
}

Powered by Google App Engine
This is Rietveld 408576698