| Index: third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl
|
| diff --git a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl
|
| index 3e32ccde735dcad12ba3ae1893d807df39c066b1..bf93f9f6a6d6834731c9ca0ef90d8328c62cb425 100644
|
| --- a/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl
|
| +++ b/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl
|
| @@ -54,14 +54,6 @@ PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs()
|
|
|
| void init()
|
| {
|
| - struct NameEntry {
|
| - const char* name;
|
| - unsigned hash;
|
| - unsigned char length;
|
| - unsigned char isTag;
|
| - unsigned char isAttr;
|
| - };
|
| -
|
| // Use placement new to initialize the globals.
|
| AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::ConstructFromLiteral);
|
|
|
| @@ -69,9 +61,19 @@ void init()
|
| new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_prefix}}NS);
|
| {% set tagnames = tags|map(attribute='name')|list() %}
|
| {% set attrnames = attrs|map(attribute='name')|list() %}
|
| - static const NameEntry kNames[] = {
|
| + const int kMaxNameLength = {{(tagnames + attrnames)|map('length')|max}} + 1;
|
| + struct NameEntry {
|
| + char string_impl_storage[sizeof(StringImpl)];
|
| + char name[kMaxNameLength];
|
| + unsigned hash;
|
| + unsigned char length;
|
| + unsigned char isTag;
|
| + unsigned char isAttr;
|
| + };
|
| +
|
| + static NameEntry Names[] = {
|
| {% for name, tag_list in (tags + attrs)|groupby('name')|sort(attribute=0, case_sensitive=True) %}
|
| - { "{{name}}", {{name|hash}}, {{name|length}}, {{ (name in tagnames)|int }}, {{ (name in attrnames)|int }} },
|
| + { "", "{{name}}", {{name|hash}}, {{name|length}}, {{ (name in tagnames)|int }}, {{ (name in attrnames)|int }} },
|
| {% endfor %}
|
| };
|
|
|
| @@ -79,16 +81,16 @@ void init()
|
| size_t tag_i = 0;
|
| {% endif %}
|
| size_t attr_i = 0;
|
| - for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) {
|
| - StringImpl* stringImpl = StringImpl::createStatic(kNames[i].name, kNames[i].length, kNames[i].hash);
|
| + for (size_t i = 0; i < WTF_ARRAY_LENGTH(Names); i++) {
|
| + StringImpl* stringImpl = StringImpl::createPreallocatedStatic(Names[i].string_impl_storage, Names[i].length, Names[i].hash);
|
| {% if tags %}
|
| - if (kNames[i].isTag) {
|
| + if (Names[i].isTag) {
|
| void* address = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorage) + tag_i;
|
| QualifiedName::createStatic(address, stringImpl, {{namespace_prefix}}NS);
|
| tag_i++;
|
| }
|
|
|
| - if (!kNames[i].isAttr)
|
| + if (!Names[i].isAttr)
|
| continue;
|
| {% endif %}
|
| void* address = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + attr_i;
|
|
|