| {% from "macros.tmpl" import license %} |
| {{ license() }} |
| |
| #include "config.h" |
| |
| #include "{{namespace}}{{suffix}}Names.h" |
| |
| #include "wtf/StdLibExtras.h" |
| |
| // Generated from: |
| {% for entry in in_files|sort %} |
| // - {{entry}} |
| {% endfor %} |
| |
| namespace blink { |
| namespace {{namespace}}Names { |
| |
| using namespace WTF; |
| |
| const int k{{suffix}}NameCount = {{entries|length}}; |
| |
| void* {{suffix}}NamesStorage[k{{suffix}}NameCount * ((sizeof(AtomicString) + sizeof(void *) - 1) / sizeof(void *))]; |
| |
| {% for entry in entries|sort(attribute='name', case_sensitive=True) %} |
| {% filter enable_conditional(entry.Conditional) %} |
| const AtomicString& {{entry|symbol}} = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage)[{{loop.index0}}]; |
| {% endfilter %} |
| {% endfor %} |
| |
| void init{{suffix}}() |
| { |
| struct NameEntry { |
| const char* name; |
| unsigned hash; |
| unsigned char length; |
| }; |
| |
| static const NameEntry kNames[] = { |
| {% for entry in entries|sort(attribute='name', case_sensitive=True) %} |
| { "{{entry|cpp_name}}", {{entry|cpp_name|hash}}, {{entry|cpp_name|length}} }, |
| {% endfor %} |
| }; |
| |
| for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) { |
| StringImpl* stringImpl = StringImpl::createStatic(kNames[i].name, kNames[i].length, kNames[i].hash); |
| void* address = reinterpret_cast<AtomicString*>(&{{suffix}}NamesStorage) + i; |
| new (address) AtomicString(stringImpl); |
| } |
| } |
| |
| } // {{namespace}}Names |
| } // namespace blink |