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

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: Patch for landing. 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
« no previous file with comments | « no previous file | Source/build/scripts/templates/MakeQualifiedNames.h.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Tags()
32 { 32 {
33 static const WebCore::QualifiedName* const {{namespace}}Tags[] = { 33 OwnPtr<const QualifiedName*[]> tags = adoptArrayPtr(new const QualifiedName* [{{namespace}}TagsCount]);
34 {%- for tag in tags|sort %} 34 {%- for tag in tags|sort %}
35 (WebCore::QualifiedName*)&{{tag|symbol}}Tag, 35 tags[{{loop.index0}}] = reinterpret_cast<const QualifiedName*>(&{{tag|symbol }}Tag);
36 {%- endfor %} 36 {%- endfor %}
37 }; 37 return tags.release();
38 return {{namespace}}Tags;
39 } 38 }
40 39
41 {%- endif %} 40 {%- endif %}
42 41
43 // Attributes 42 // Attributes
44 {%- for attr in attrs|sort %} 43 {%- for attr in attrs|sort %}
45 DEFINE_GLOBAL(QualifiedName, {{attr|symbol}}Attr) 44 DEFINE_GLOBAL(QualifiedName, {{attr|symbol}}Attr)
46 {%- endfor %} 45 {%- endfor %}
47 46
48 const WebCore::QualifiedName* const* get{{namespace}}Attrs() 47 PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs()
49 { 48 {
50 static const WebCore::QualifiedName* const {{namespace}}Attrs[] = { 49 OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName *[{{namespace}}AttrsCount]);
51 {%- for attr in attrs|sort %} 50 {%- for attr in attrs|sort %}
52 (WebCore::QualifiedName*)&{{attr|symbol}}Attr, 51 attrs[{{loop.index0}}] = reinterpret_cast<const WebCore::QualifiedName*>(&{{ attr|symbol}}Attr);
53 {%- endfor %} 52 {%- endfor %}
54 }; 53 return attrs.release();
55 return {{namespace}}Attrs;
56 } 54 }
57 55
58 void init() 56 void init()
59 { 57 {
60 // Use placement new to initialize the globals. 58 // Use placement new to initialize the globals.
61 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::Const ructFromLiteral); 59 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::Const ructFromLiteral);
62 60
63 // Namespace 61 // Namespace
64 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_pref ix}}NS); 62 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_pref ix}}NS);
65 63
(...skipping 11 matching lines...) Expand all
77 {%- if use_namespace_for_attrs %} 75 {%- if use_namespace_for_attrs %}
78 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{name space_prefix}}NS); 76 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{name space_prefix}}NS);
79 {%- else %} 77 {%- else %}
80 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl); 78 createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl);
81 {%- endif %} 79 {%- endif %}
82 {%- endfor %} 80 {%- endfor %}
83 } 81 }
84 82
85 } // {{namespace}} 83 } // {{namespace}}
86 } // WebCore 84 } // WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/build/scripts/templates/MakeQualifiedNames.h.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698