Chromium Code Reviews| Index: Source/bindings/templates/constants.cpp |
| diff --git a/Source/bindings/templates/constants.cpp b/Source/bindings/templates/constants.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6e289ddb73e3021b860e5605fe635e249041ab1d |
| --- /dev/null |
| +++ b/Source/bindings/templates/constants.cpp |
| @@ -0,0 +1,54 @@ |
| +{# FIXME: remove all the conditional_string blocks once test removed #} |
| +{# FIXME: should use name_reflect instead of name #} |
| +{# FIXME: do we need separate value and value_raw? #} |
| +{% macro class_consts() %} |
|
haraken
2013/08/22 07:31:33
class_consts => define_constants
Nils Barth (inactive)
2013/08/22 09:08:13
(See above.)
|
| +static const V8DOMConfiguration::BatchedConstant {{v8_class_name}}Consts[] = { |
|
haraken
2013/08/22 07:31:33
{{v8_class_name}}Consts[] => {{v8_class_name}}Cons
Nils Barth (inactive)
2013/08/22 09:08:13
(Perl.)
|
| +{% for constant in constants %} |
| +{% if not constant.enabled_at_runtime %} |
| +{% if constant.conditional_string %} |
| +#if {{constant.conditional_string}} |
| +{% endif %} |
| + {"{{constant.name}}", {{constant.value}}}, |
| +{% if constant.conditional_string %} |
| +#endif // {{constant.conditional_string}} |
| +{% endif %} |
| +{% endif %}{# not constant.enabled_at_runtime #} |
| +{% endfor %} |
| +}; |
| +{% if not do_not_check_constants %} |
| + |
| + |
|
haraken
2013/08/22 07:31:33
Nit: Unnecessary empty line.
Nils Barth (inactive)
2013/08/22 09:08:13
(Perl.)
|
| +{% for constant in constants %} |
| +{% if constant.conditional_string %} |
| +#if {{constant.conditional_string}} |
| +{% endif %} |
| +COMPILE_ASSERT({{constant.value_raw}} == {{cpp_class_name}}::{{constant.name_reflect}}, {{cpp_class_name}}Enum{{constant.name_reflect}}IsWrongUseDoNotCheckConstants); |
|
haraken
2013/08/22 07:31:33
{{cpp_class_name}}Enum{{constant.name_reflect}}IsW
Nils Barth (inactive)
2013/08/22 09:08:13
Perl.
...and should:
Doesn'tMatchWithImplementatio
|
| +{% if constant.conditional_string %} |
| +#endif // {{constant.conditional_string}} |
| +{% endif %} |
| +{% endfor %} |
| +{% endif %}{# not do_not_check_constants #} |
| +{% endmacro %}{# class_consts #} |
| + |
| + |
| +{##############################################################################} |
| +{% macro const_data(constant) %} |
|
haraken
2013/08/22 07:31:33
const_data => install_runtime_enabled_constant
Nils Barth (inactive)
2013/08/22 09:08:13
(See above.)
|
| +{% if constant.enabled_at_runtime %} |
| +{% if constant.conditional_string %} |
| +#if {{constant.conditional_string}} |
| +{% endif %} |
| + if ({{constant.enable_function}}()) { |
| + static const V8DOMConfiguration::BatchedConstant constData = {"{{constant.name}}", static_cast<signed int>({{constant.value}})}; |
|
haraken
2013/08/22 07:31:33
constData => constantConfiguration ?
Nils Barth (inactive)
2013/08/22 09:08:13
I *think* the "Configuration" is just for initiali
haraken
2013/08/22 11:05:28
This is used just for initialization. That's the r
Nils Barth (inactive)
2013/08/23 01:50:05
Got it, will do!
|
| + V8DOMConfiguration::batchConfigureConstants(desc, proto, &constData, 1, isolate); |
| + } |
| +{% if constant.conditional_string %} |
| +#endif // {{constant.conditional_string}} |
| +{%- endif %} |
|
haraken
2013/08/22 07:31:33
Ditto. What is the '-' ?
Nils Barth (inactive)
2013/08/22 09:08:13
It removes trailing whitespace; I'm using it here
|
| +{% endif %} |
| +{% endmacro %}{# const_data #} |
| + |
| + |
| +{##############################################################################} |
| +{% macro batch_configure_constants() %} |
|
haraken
2013/08/22 07:31:33
batch_configure_constants => install_constants
Nils Barth (inactive)
2013/08/22 09:08:13
(See above.)
|
| +V8DOMConfiguration::batchConfigureConstants(desc, proto, {{v8_class_name}}Consts, WTF_ARRAY_LENGTH({{v8_class_name}}Consts), isolate); |
|
haraken
2013/08/22 07:31:33
Probably we want to rename the method to installCo
Nils Barth (inactive)
2013/08/22 09:08:13
FIXME added!
|
| +{%- endmacro %} |