summaryrefslogtreecommitdiff
path: root/chromium/third_party/WebKit/Source/build/scripts/templates/MakeNames.cpp.tmpl
blob: 792acc3a5f8ab293da5d154963b736e57920c10e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
{% from "macros.tmpl" import license -%}
{{ license() }}

#include "config.h"

#ifdef SKIP_STATIC_CONSTRUCTORS_ON_GCC
#define {{namespace|to_macro_style}}_NAMES_HIDE_GLOBALS 1
#endif

#include "{{namespace}}Names.h"

#include "wtf/StaticConstructors.h"

namespace WebCore {
namespace {{namespace}}Names {

using namespace WTF;

{%- for entry in entries|sort %}
{%- if export %}
DEFINE_GLOBAL(AtomicString, {{entry|symbol}}Storage)
{{export}} const AtomicString& {{entry|symbol}} = *reinterpret_cast<const AtomicString*>(&{{entry|symbol}}Storage);
{%- else %}
DEFINE_GLOBAL(AtomicString, {{entry|symbol}})
{%- endif %}
{%- endfor %}

void init()
{
{%- for entry in entries|sort %}
    StringImpl* {{entry|symbol}}Impl = StringImpl::createStatic("{{entry|cpp_name}}", {{entry|cpp_name|length}}, {{entry|cpp_name|hash}});
{%- endfor %}


{%- for entry in entries|sort %}
    new ((void*)&{{entry|symbol}}) AtomicString({{entry|symbol}}Impl);
{%- endfor %}
}

} // {{namespace}}
} // WebCore