| OLD | NEW |
| 1 {% from "macros.tmpl" import license %} | 1 {% from "macros.tmpl" import license %} |
| 2 {{ license() }} | 2 {{ license() }} |
| 3 | 3 |
| 4 #include "{{namespace}}Names.h" | 4 #include "{{namespace}}Names.h" |
| 5 | 5 |
| 6 #include "wtf/StaticConstructors.h" | 6 #include "wtf/StaticConstructors.h" |
| 7 #include "wtf/StdLibExtras.h" | 7 #include "wtf/StdLibExtras.h" |
| 8 | 8 |
| 9 namespace blink { | 9 namespace blink { |
| 10 namespace {{namespace}}Names { | 10 namespace {{namespace}}Names { |
| 11 | 11 |
| 12 using namespace blink; | 12 using namespace blink; |
| 13 | 13 |
| 14 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI) | 14 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI) |
| 15 | 15 |
| 16 {% if tags %} | 16 {% if tags %} |
| 17 // Tags | 17 // Tags |
| 18 | 18 |
| 19 void* {{suffix}}TagStorage[{{namespace}}TagsCount * ((sizeof({{namespace}}Qualif
iedName) + sizeof(void *) - 1) / sizeof(void *))]; | 19 void* {{suffix}}TagStorage[{{namespace}}TagsCount * ((sizeof({{namespace}}Qualif
iedName) + sizeof(void *) - 1) / sizeof(void *))]; |
| 20 {% for tag in tags|sort(attribute='name', case_sensitive=True) %} | 20 {% for tag in tags|sort(attribute='name', case_sensitive=True) %} |
| 21 const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespa
ce}}QualifiedName*>(&{{suffix}}TagStorage)[{{loop.index0}}]; | 21 const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespa
ce}}QualifiedName*>(&{{suffix}}TagStorage)[{{loop.index0}}]; |
| 22 {% endfor %} | 22 {% endfor %} |
| 23 | 23 |
| 24 | 24 |
| 25 PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() | 25 PassOwnPtr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() |
| 26 { | 26 { |
| 27 OwnPtr<const {{namespace}}QualifiedName*[]> tags = adoptArrayPtr(new const {
{namespace}}QualifiedName*[{{namespace}}TagsCount]); | 27 OwnPtr<const {{namespace}}QualifiedName*[]> tags = adoptArrayPtr(new const {
{namespace}}QualifiedName*[{{namespace}}TagsCount]); |
| 28 for (size_t i = 0; i < {{namespace}}TagsCount; i++) | 28 for (size_t i = 0; i < {{namespace}}TagsCount; i++) |
| 29 tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagSt
orage) + i; | 29 tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagSt
orage) + i; |
| 30 return tags.release(); | 30 return tags; |
| 31 } | 31 } |
| 32 | 32 |
| 33 {% endif %} | 33 {% endif %} |
| 34 // Attributes | 34 // Attributes |
| 35 | 35 |
| 36 void* {{suffix}}AttrStorage[{{namespace}}AttrsCount * ((sizeof(QualifiedName) +
sizeof(void *) - 1) / sizeof(void *))]; | 36 void* {{suffix}}AttrStorage[{{namespace}}AttrsCount * ((sizeof(QualifiedName) +
sizeof(void *) - 1) / sizeof(void *))]; |
| 37 | 37 |
| 38 {% for attr in attrs|sort(attribute='name', case_sensitive=True) %} | 38 {% for attr in attrs|sort(attribute='name', case_sensitive=True) %} |
| 39 const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&{{s
uffix}}AttrStorage)[{{loop.index0}}]; | 39 const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&{{s
uffix}}AttrStorage)[{{loop.index0}}]; |
| 40 {% endfor %} | 40 {% endfor %} |
| 41 | 41 |
| 42 {% if namespace != 'HTML' %} | 42 {% if namespace != 'HTML' %} |
| 43 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs() | 43 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs() |
| 44 { | 44 { |
| 45 OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName
*[{{namespace}}AttrsCount]); | 45 OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName
*[{{namespace}}AttrsCount]); |
| 46 for (size_t i = 0; i < {{namespace}}AttrsCount; i++) | 46 for (size_t i = 0; i < {{namespace}}AttrsCount; i++) |
| 47 attrs[i] = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + i; | 47 attrs[i] = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + i; |
| 48 return attrs.release(); | 48 return attrs; |
| 49 } | 49 } |
| 50 {% endif %} | 50 {% endif %} |
| 51 | 51 |
| 52 | 52 |
| 53 void init() | 53 void init() |
| 54 { | 54 { |
| 55 struct NameEntry { | 55 struct NameEntry { |
| 56 const char* name; | 56 const char* name; |
| 57 unsigned hash; | 57 unsigned hash; |
| 58 unsigned char length; | 58 unsigned char length; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 attr_i++; | 98 attr_i++; |
| 99 } | 99 } |
| 100 {% if tags %} | 100 {% if tags %} |
| 101 ASSERT(tag_i == {{namespace}}TagsCount); | 101 ASSERT(tag_i == {{namespace}}TagsCount); |
| 102 {% endif %} | 102 {% endif %} |
| 103 ASSERT(attr_i == {{namespace}}AttrsCount); | 103 ASSERT(attr_i == {{namespace}}AttrsCount); |
| 104 } | 104 } |
| 105 | 105 |
| 106 } // {{namespace}} | 106 } // {{namespace}} |
| 107 } // namespace blink | 107 } // namespace blink |
| OLD | NEW |