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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
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/PtrUtil.h" 6 #include "wtf/PtrUtil.h"
7 #include "wtf/StaticConstructors.h" 7 #include "wtf/StaticConstructors.h"
8 #include "wtf/StdLibExtras.h" 8 #include "wtf/StdLibExtras.h"
9 #include <memory> 9 #include <memory>
10 10
11 namespace blink { 11 namespace blink {
12 namespace {{namespace}}Names { 12 namespace {{namespace}}Names {
13 13
14 using namespace blink; 14 using namespace blink;
15 15
16 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI); 16 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI);
17 17
18 {% if tags %} 18 {% if tags %}
19 // Tags 19 // Tags
20 20
21 void* {{suffix}}TagStorage[{{namespace}}TagsCount * ((sizeof({{namespace}}Qualif iedName) + sizeof(void *) - 1) / sizeof(void *))]; 21 void* {{suffix}}TagStorage[{{namespace}}TagsCount * ((sizeof({{namespace}}Qualif iedName) + sizeof(void *) - 1) / sizeof(void *))];
22 {% for tag in tags|sort(attribute='name', case_sensitive=True) %} 22 {% for tag in tags|sort(attribute='name', case_sensitive=True) %}
23 const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespa ce}}QualifiedName*>(&{{suffix}}TagStorage)[{{loop.index0}}]; 23 const {{namespace}}QualifiedName& {{tag|symbol}}Tag = reinterpret_cast<{{namespa ce}}QualifiedName*>(&{{suffix}}TagStorage)[{{loop.index0}}];
24 {% endfor %} 24 {% endfor %}
25 25
26 26
27 std::unique_ptr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() { 27 std::unique_ptr<const {{namespace}}QualifiedName*[]> get{{namespace}}Tags() {
28 std::unique_ptr<const {{namespace}}QualifiedName*[]> tags = wrapArrayUnique(ne w const {{namespace}}QualifiedName*[{{namespace}}TagsCount]); 28 std::unique_ptr<const {{namespace}}QualifiedName*[]> tags = WrapArrayUnique(ne w const {{namespace}}QualifiedName*[{{namespace}}TagsCount]);
29 for (size_t i = 0; i < {{namespace}}TagsCount; i++) 29 for (size_t i = 0; i < {{namespace}}TagsCount; i++)
30 tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorag e) + i; 30 tags[i] = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}TagStorag e) + i;
31 return tags; 31 return tags;
32 } 32 }
33 33
34 {% endif %} 34 {% endif %}
35 // Attributes 35 // Attributes
36 36
37 void* {{suffix}}AttrStorage[{{namespace}}AttrsCount * ((sizeof(QualifiedName) + sizeof(void *) - 1) / sizeof(void *))]; 37 void* {{suffix}}AttrStorage[{{namespace}}AttrsCount * ((sizeof(QualifiedName) + sizeof(void *) - 1) / sizeof(void *))];
38 38
39 {% for attr in attrs|sort(attribute='name', case_sensitive=True) %} 39 {% for attr in attrs|sort(attribute='name', case_sensitive=True) %}
40 const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&{{s uffix}}AttrStorage)[{{loop.index0}}]; 40 const QualifiedName& {{attr|symbol}}Attr = reinterpret_cast<QualifiedName*>(&{{s uffix}}AttrStorage)[{{loop.index0}}];
41 {% endfor %} 41 {% endfor %}
42 42
43 {% if namespace != 'HTML' %} 43 {% if namespace != 'HTML' %}
44 std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs() { 44 std::unique_ptr<const QualifiedName*[]> get{{namespace}}Attrs() {
45 std::unique_ptr<const QualifiedName*[]> attrs = wrapArrayUnique(new const Qual ifiedName*[{{namespace}}AttrsCount]); 45 std::unique_ptr<const QualifiedName*[]> attrs = WrapArrayUnique(new const Qual ifiedName*[{{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; 48 return attrs;
49 } 49 }
50 {% endif %} 50 {% endif %}
51 51
52 52
53 void init() { 53 void init() {
54 struct NameEntry { 54 struct NameEntry {
55 const char* name; 55 const char* name;
(...skipping 14 matching lines...) Expand all
70 {% for name, tag_list in (tags + attrs)|groupby('name')|sort(attribute=0, case _sensitive=True) %} 70 {% for name, tag_list in (tags + attrs)|groupby('name')|sort(attribute=0, case _sensitive=True) %}
71 { "{{name}}", {{name|hash}}, {{name|length}}, {{ (name in tagnames)|int }}, {{ (name in attrnames)|int }} }, 71 { "{{name}}", {{name|hash}}, {{name|length}}, {{ (name in tagnames)|int }}, {{ (name in attrnames)|int }} },
72 {% endfor %} 72 {% endfor %}
73 }; 73 };
74 74
75 {% if tags %} 75 {% if tags %}
76 size_t tag_i = 0; 76 size_t tag_i = 0;
77 {% endif %} 77 {% endif %}
78 size_t attr_i = 0; 78 size_t attr_i = 0;
79 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) { 79 for (size_t i = 0; i < WTF_ARRAY_LENGTH(kNames); i++) {
80 StringImpl* stringImpl = StringImpl::createStatic(kNames[i].name, kNames[i]. length, kNames[i].hash); 80 StringImpl* stringImpl = StringImpl::CreateStatic(kNames[i].name, kNames[i]. length, kNames[i].hash);
81 {% if tags %} 81 {% if tags %}
82 if (kNames[i].isTag) { 82 if (kNames[i].isTag) {
83 void* address = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}T agStorage) + tag_i; 83 void* address = reinterpret_cast<{{namespace}}QualifiedName*>(&{{suffix}}T agStorage) + tag_i;
84 QualifiedName::createStatic(address, stringImpl, {{namespace_prefix}}NS); 84 QualifiedName::CreateStatic(address, stringImpl, {{namespace_prefix}}NS);
85 tag_i++; 85 tag_i++;
86 } 86 }
87 87
88 if (!kNames[i].isAttr) 88 if (!kNames[i].isAttr)
89 continue; 89 continue;
90 {% endif %} 90 {% endif %}
91 void* address = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + a ttr_i; 91 void* address = reinterpret_cast<QualifiedName*>(&{{suffix}}AttrStorage) + a ttr_i;
92 {% if use_namespace_for_attrs %} 92 {% if use_namespace_for_attrs %}
93 QualifiedName::createStatic(address, stringImpl, {{namespace_prefix}}NS); 93 QualifiedName::CreateStatic(address, stringImpl, {{namespace_prefix}}NS);
94 {% else %} 94 {% else %}
95 QualifiedName::createStatic(address, stringImpl); 95 QualifiedName::CreateStatic(address, stringImpl);
96 {% endif %} 96 {% endif %}
97 attr_i++; 97 attr_i++;
98 } 98 }
99 {% if tags %} 99 {% if tags %}
100 ASSERT(tag_i == {{namespace}}TagsCount); 100 ASSERT(tag_i == {{namespace}}TagsCount);
101 {% endif %} 101 {% endif %}
102 ASSERT(attr_i == {{namespace}}AttrsCount); 102 ASSERT(attr_i == {{namespace}}AttrsCount);
103 } 103 }
104 104
105 } // {{namespace}} 105 } // {{namespace}}
106 } // namespace blink 106 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698