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

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

Issue 1844223002: Literal AtomicString construction can rely on strlen optimization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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/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 {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
59 unsigned char isTag; 59 unsigned char isTag;
60 unsigned char isAttr; 60 unsigned char isAttr;
61 }; 61 };
62 62
63 // Use placement new to initialize the globals. 63 // Use placement new to initialize the globals.
64 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}", AtomicString::Const ructFromLiteral); 64 AtomicString {{namespace_prefix}}NS("{{namespace_uri}}");
65 65
66 // Namespace 66 // Namespace
67 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_pref ix}}NS); 67 new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_pref ix}}NS);
68 {% set tagnames = tags|map(attribute='name')|list() %} 68 {% set tagnames = tags|map(attribute='name')|list() %}
69 {% set attrnames = attrs|map(attribute='name')|list() %} 69 {% set attrnames = attrs|map(attribute='name')|list() %}
70 static const NameEntry kNames[] = { 70 static const NameEntry kNames[] = {
71 {% for name, tag_list in (tags + attrs)|groupby('name')|sort(attribute=0, ca se_sensitive=True) %} 71 {% for name, tag_list in (tags + attrs)|groupby('name')|sort(attribute=0, ca se_sensitive=True) %}
72 { "{{name}}", {{name|hash}}, {{name|length}}, {{ (name in tagnames)|int }}, {{ (name in attrnames)|int }} }, 72 { "{{name}}", {{name|hash}}, {{name|length}}, {{ (name in tagnames)|int }}, {{ (name in attrnames)|int }} },
73 {% endfor %} 73 {% endfor %}
74 }; 74 };
(...skipping 23 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698