diff options
Diffstat (limited to 'chromium/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl')
-rw-r--r-- | chromium/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl | 67 |
1 files changed, 31 insertions, 36 deletions
diff --git a/chromium/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl b/chromium/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl index e6ff66955bf..ace33f70e1f 100644 --- a/chromium/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl +++ b/chromium/third_party/WebKit/Source/build/scripts/templates/MakeQualifiedNames.cpp.tmpl @@ -1,4 +1,4 @@ -{% from "macros.tmpl" import license -%} +{% from "macros.tmpl" import license %} {{ license() }} #include "config.h" @@ -20,39 +20,35 @@ using namespace WebCore; DEFINE_GLOBAL(AtomicString, {{namespace_prefix}}NamespaceURI) -{%- if tags %} - +{% if tags %} // Tags -{%- for tag in tags|sort %} +{% for tag in tags|sort %} DEFINE_GLOBAL(QualifiedName, {{tag|symbol}}Tag) -{%- endfor %} +{% endfor %} -const WebCore::QualifiedName* const* get{{namespace}}Tags() +PassOwnPtr<const QualifiedName*[]> get{{namespace}}Tags() { - static const WebCore::QualifiedName* const {{namespace}}Tags[] = { -{%- for tag in tags|sort %} - (WebCore::QualifiedName*)&{{tag|symbol}}Tag, -{%- endfor %} - }; - return {{namespace}}Tags; + OwnPtr<const QualifiedName*[]> tags = adoptArrayPtr(new const QualifiedName*[{{namespace}}TagsCount]); + {% for tag in tags|sort %} + tags[{{loop.index0}}] = reinterpret_cast<const QualifiedName*>(&{{tag|symbol}}Tag); + {% endfor %} + return tags.release(); } -{%- endif %} - +{% endif %} // Attributes -{%- for attr in attrs|sort %} +{% for attr in attrs|sort %} DEFINE_GLOBAL(QualifiedName, {{attr|symbol}}Attr) -{%- endfor %} +{% endfor %} -const WebCore::QualifiedName* const* get{{namespace}}Attrs() +PassOwnPtr<const QualifiedName*[]> get{{namespace}}Attrs() { - static const WebCore::QualifiedName* const {{namespace}}Attrs[] = { -{%- for attr in attrs|sort %} - (WebCore::QualifiedName*)&{{attr|symbol}}Attr, -{%- endfor %} - }; - return {{namespace}}Attrs; + OwnPtr<const QualifiedName*[]> attrs = adoptArrayPtr(new const QualifiedName*[{{namespace}}AttrsCount]); + {% for attr in attrs|sort %} + attrs[{{loop.index0}}] = reinterpret_cast<const WebCore::QualifiedName*>(&{{attr|symbol}}Attr); + {% endfor %} + return attrs.release(); } void init() @@ -62,24 +58,23 @@ void init() // Namespace new ((void*)&{{namespace_prefix}}NamespaceURI) AtomicString({{namespace_prefix}}NS); - -{%- for name, tag_list in (tags + attrs)|groupby('name')|sort %} + {% for name, tag_list in (tags + attrs)|groupby('name')|sort %} StringImpl* {{tag_list[0]|symbol}}Impl = StringImpl::createStatic("{{name}}", {{name|length}}, {{name|hash}}); -{%- endfor %} + {% endfor %} // Tags -{%- for tag in tags|sort %} - createQualifiedName((void*)&{{tag|symbol}}Tag, {{tag|symbol}}Impl, {{namespace_prefix}}NS); -{%- endfor %} + {% for tag in tags|sort %} + QualifiedName::createStatic((void*)&{{tag|symbol}}Tag, {{tag|symbol}}Impl, {{namespace_prefix}}NS); + {% endfor %} // Attrs -{%- for attr in attrs|sort %} -{%- if use_namespace_for_attrs %} - createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{namespace_prefix}}NS); -{%- else %} - createQualifiedName((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl); -{%- endif %} -{%- endfor %} + {% for attr in attrs|sort %} + {% if use_namespace_for_attrs %} + QualifiedName::createStatic((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl, {{namespace_prefix}}NS); + {% else %} + QualifiedName::createStatic((void*)&{{attr|symbol}}Attr, {{attr|symbol}}Impl); + {% endif %} + {% endfor %} } } // {{namespace}} |