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

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

Issue 137783012: MakeQualifiedNames should generate lazily created arrays for attributes and tags. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 "config.h" 4 #include "config.h"
5 5
6 #ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC 6 #ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
7 #define {{namespace|to_macro_style}}_NAMES_HIDE_GLOBALS 1 7 #define {{namespace|to_macro_style}}_NAMES_HIDE_GLOBALS 1
8 #else 8 #else
9 #define QNAME_DEFAULT_CONSTRUCTOR 1 9 #define QNAME_DEFAULT_CONSTRUCTOR 1
10 #endif 10 #endif
(...skipping 10 matching lines...) Expand all
21 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI) 21 DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI)
22 22
23 {%- if tags %} 23 {%- if tags %}
24 24
25 // Tags 25 // Tags
26 {%- for tag in tags|sort %} 26 {%- for tag in tags|sort %}
27 DEFINE_GLOBAL(QualifiedName, {{tag|symbol}}Tag) 27 DEFINE_GLOBAL(QualifiedName, {{tag|symbol}}Tag)
28 {%- endfor %} 28 {%- endfor %}
29 29
30 30
31 const WebCore::QualifiedName* const* get{{namespace}}Tags() 31 void get{{namespace}}Tags(WebCore::QualifiedName* tags[], unsigned length)
32 { 32 {
33 static const WebCore::QualifiedName* const {{namespace}}Tags[] = { 33 ASSERT(length == {{namespace}}TagsCount);
34 {%- for tag in tags|sort %} 34 {%- for tag in tags|sort %}
35 (WebCore::QualifiedName*)&{{tag|symbol}}Tag, 35 tags[{{loop.index0}}] = (WebCore::QualifiedName*)&{{tag|symbol}}Tag;
36 {%- endfor %} 36 {%- endfor %}
37 };
38 return {{namespace}}Tags;
39 } 37 }
40 38
41 {%- endif %} 39 {%- endif %}
42 40
43 // Attributes 41 // Attributes
44 {%- for attr in attrs|sort %} 42 {%- for attr in attrs|sort %}
45 DEFINE_GLOBAL(QualifiedName, {{attr|symbol}}Attr) 43 DEFINE_GLOBAL(QualifiedName, {{attr|symbol}}Attr)
46 {%- endfor %} 44 {%- endfor %}
47 45
48 const WebCore::QualifiedName* const* get{{namespace}}Attrs() 46 void get{{namespace}}Attrs(WebCore::QualifiedName* attributes[], unsigned length )
49 { 47 {
50 static const WebCore::QualifiedName* const {{namespace}}Attrs[] = { 48 ASSERT(length == {{namespace}}AttrsCount);
51 {%- for attr in attrs|sort %} 49 {%- for attr in attrs|sort %}
52 (WebCore::QualifiedName*)&{{attr|symbol}}Attr, 50 attributes[{{loop.index0}}] = (WebCore::QualifiedName*)&{{attr|symbol}}Attr;
53 {%- endfor %} 51 {%- endfor %}
54 };
55 return {{namespace}}Attrs;
56 } 52 }
57 53
58 void init() 54 void init()
59 { 55 {
60 // Use placement new to initialize the globals. 56 // Use placement new to initialize the globals.
61 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::Const ructFromLiteral); 57 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::Const ructFromLiteral);
62 58
63 // Namespace 59 // Namespace
64 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_pref ix}}NS); 60 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_pref ix}}NS);
65 61
(...skipping 11 matching lines...) Expand all
77 {%- if use_namespace_for_attrs %} 73 {%- if use_namespace_for_attrs %}
78 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{name space_prefix}}NS); 74 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{name space_prefix}}NS);
79 {%- else %} 75 {%- else %}
80 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl); 76 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl);
81 {%- endif %} 77 {%- endif %}
82 {%- endfor %} 78 {%- endfor %}
83 } 79 }
84 80
85 } // {{namespace}} 81 } // {{namespace}}
86 } // WebCore 82 } // WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698