| Index: Source/bindings/templates/constants.cpp
 | 
| diff --git a/Source/bindings/templates/constants.cpp b/Source/bindings/templates/constants.cpp
 | 
| index d916167d5d9a7cd585edda62dedb0eb863458faf..57133747c72a546135e430226bc4104a4fb472bb 100644
 | 
| --- a/Source/bindings/templates/constants.cpp
 | 
| +++ b/Source/bindings/templates/constants.cpp
 | 
| @@ -1,36 +1,49 @@
 | 
| -{######################################}
 | 
| -{% macro install_constants() %}
 | 
| -{% if has_constant_configuration %}
 | 
| -{# Normal constants #}
 | 
| -static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] = {
 | 
| -    {% for constant in constants if not constant.runtime_enabled_function %}
 | 
| +{##############################################################################}
 | 
| +{% macro constant_getter_callback(constant) %}
 | 
| +{% filter conditional(constant.conditional_string) %}
 | 
| +static void {{constant.name}}ConstantGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
 | 
| +{
 | 
| +    TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter");
 | 
| +    {% if constant.deprecate_as %}
 | 
| +    UseCounter::countDeprecation(callingExecutionContext(info.GetIsolate()), UseCounter::{{constant.deprecate_as}});
 | 
| +    {% endif %}
 | 
| +    {% if constant.measure_as %}
 | 
| +    UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{constant.measure_as}});
 | 
| +    {% endif %}
 | 
|      {% if constant.idl_type in ('Double', 'Float') %}
 | 
| -        {% set value = '0, %s, 0' % constant.value %}
 | 
| +    v8SetReturnValue(info, {{constant.value}});
 | 
|      {% elif constant.idl_type == 'String' %}
 | 
| -        {% set value = '0, 0, %s' % constant.value %}
 | 
| +    v8SetReturnValueString(info, "{{constant.value}}");
 | 
|      {% else %}
 | 
| -        {# 'Short', 'Long' etc. #}
 | 
| -        {% set value = '%s, 0, 0' % constant.value %}
 | 
| +    v8SetReturnValueInt(info, {{constant.value}});
 | 
|      {% endif %}
 | 
| -    {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_type}}},
 | 
| +    TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
 | 
| +}
 | 
| +{% endfilter %}
 | 
| +{% endmacro %}
 | 
| +
 | 
| +
 | 
| +{######################################}
 | 
| +{% macro install_constants() %}
 | 
| +{% if constant_configuration_constants %}
 | 
| +{# Normal constants #}
 | 
| +static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] = {
 | 
| +    {% for constant in constant_configuration_constants %}
 | 
| +    {{constant_configuration(constant)}},
 | 
|      {% endfor %}
 | 
|  };
 | 
|  V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, {{v8_class}}Constants, WTF_ARRAY_LENGTH({{v8_class}}Constants), isolate);
 | 
|  {% endif %}
 | 
|  {# Runtime-enabled constants #}
 | 
| -{% for constant in constants if constant.runtime_enabled_function %}
 | 
| -if ({{constant.runtime_enabled_function}}()) {
 | 
| -    {% if constant.idl_type in ('Double', 'Float') %}
 | 
| -        {% set value = '0, %s, 0' % constant.value %}
 | 
| -    {% elif constant.idl_type == 'String' %}
 | 
| -        {% set value = '0, 0, %s' % constant.value %}
 | 
| -    {% else %}
 | 
| -        {# 'Short', 'Long' etc. #}
 | 
| -        {% set value = '%s, 0, 0' % constant.value %}
 | 
| -    {% endif %}
 | 
| -    static const V8DOMConfiguration::ConstantConfiguration constantConfiguration = {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_type}}};
 | 
| -    V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, &constantConfiguration, 1, isolate);
 | 
| -}
 | 
| +{% for constant in runtime_enabled_constants %}
 | 
| +{% filter runtime_enabled(constant.runtime_enabled_function) %}
 | 
| +static const V8DOMConfiguration::ConstantConfiguration constantConfiguration = {{constant_configuration(constant)}};
 | 
| +V8DOMConfiguration::installConstants(functionTemplate, prototypeTemplate, &constantConfiguration, 1, isolate);
 | 
| +{% endfilter %}
 | 
| +{% endfor %}
 | 
| +{# Constants with [DeprecateAs] or [MeasureAs] #}
 | 
| +{% for constant in special_getter_constants %}
 | 
| +V8DOMConfiguration::installConstant(functionTemplate, prototypeTemplate, "{{constant.name}}", {{cpp_class}}V8Internal::{{constant.name}}ConstantGetterCallback, isolate);
 | 
|  {% endfor %}
 | 
|  {# Check constants #}
 | 
|  {% if not do_not_check_constants %}
 | 
| @@ -42,3 +55,17 @@ COMPILE_ASSERT({{constant.value}} == {{constant_cpp_class}}::{{constant.reflecte
 | 
|  {% endfor %}
 | 
|  {% endif %}
 | 
|  {% endmacro %}
 | 
| +
 | 
| +
 | 
| +{######################################}
 | 
| +{%- macro constant_configuration(constant) %}
 | 
| +{% if constant.idl_type in ('Double', 'Float') %}
 | 
| +    {% set value = '0, %s, 0' % constant.value %}
 | 
| +{% elif constant.idl_type == 'String' %}
 | 
| +    {% set value = '0, 0, "%s"' % constant.value %}
 | 
| +{% else %}
 | 
| +    {# 'Short', 'Long' etc. #}
 | 
| +    {% set value = '%s, 0, 0' % constant.value %}
 | 
| +{% endif %}
 | 
| +{"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_type}}}
 | 
| +{%- endmacro %}
 | 
| 
 |