| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro constant_getter_callback(constant) %} | 2 {% macro constant_getter_callback(constant) %} |
| 3 {{exported}}void {{constant.name}}ConstantGetterCallback(v8::Local<v8::Name>, co
nst v8::PropertyCallbackInfo<v8::Value>& info) { | 3 void {{v8_class_or_partial}}::{{constant.name}}ConstantGetterCallback(v8::Local<
v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 4 {% if constant.deprecate_as %} | 4 {% if constant.deprecate_as %} |
| 5 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{constant.deprecate_as}}); | 5 Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseC
ounter::{{constant.deprecate_as}}); |
| 6 {% endif %} | 6 {% endif %} |
| 7 {% if constant.measure_as %} | 7 {% if constant.measure_as %} |
| 8 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{co
nstant.measure_as('ConstantGetter')}}); | 8 UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{co
nstant.measure_as('ConstantGetter')}}); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {% if constant.idl_type in ('Double', 'Float') %} | 10 {% if constant.idl_type in ('Double', 'Float') %} |
| 11 v8SetReturnValue(info, {{constant.value}}); | 11 v8SetReturnValue(info, {{constant.value}}); |
| 12 {% elif constant.idl_type == 'String' %} | 12 {% elif constant.idl_type == 'String' %} |
| 13 v8SetReturnValueString(info, "{{constant.value}}"); | 13 v8SetReturnValueString(info, "{{constant.value}}"); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 34 {% filter runtime_enabled(group.list[0].runtime_enabled_feature_name) %} | 34 {% filter runtime_enabled(group.list[0].runtime_enabled_feature_name) %} |
| 35 {% for constant in group.list %} | 35 {% for constant in group.list %} |
| 36 {% set constant_name = constant.name.title().replace('_', '') %} | 36 {% set constant_name = constant.name.title().replace('_', '') %} |
| 37 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configu
ration = {{constant_configuration(constant)}}; | 37 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configu
ration = {{constant_configuration(constant)}}; |
| 38 V8DOMConfiguration::installConstant(isolate, interfaceTemplate, prototypeTemplat
e, constant{{constant_name}}Configuration); | 38 V8DOMConfiguration::installConstant(isolate, interfaceTemplate, prototypeTemplat
e, constant{{constant_name}}Configuration); |
| 39 {% endfor %} | 39 {% endfor %} |
| 40 {% endfilter %} | 40 {% endfilter %} |
| 41 {% endfor %} | 41 {% endfor %} |
| 42 {# Constants with [DeprecateAs] or [MeasureAs] #} | 42 {# Constants with [DeprecateAs] or [MeasureAs] #} |
| 43 {% for constant in constants | has_special_getter %} | 43 {% for constant in constants | has_special_getter %} |
| 44 V8DOMConfiguration::installConstantWithGetter(isolate, interfaceTemplate, protot
ypeTemplate, "{{constant.name}}", {{cpp_class}}V8Internal::{{constant.name}}Cons
tantGetterCallback); | 44 V8DOMConfiguration::installConstantWithGetter(isolate, interfaceTemplate, protot
ypeTemplate, "{{constant.name}}", {{v8_class_or_partial}}::{{constant.name}}Cons
tantGetterCallback); |
| 45 {% endfor %} | 45 {% endfor %} |
| 46 {# Check constants #} | 46 {# Check constants #} |
| 47 {% if not do_not_check_constants %} | 47 {% if not do_not_check_constants %} |
| 48 {% for constant in constants %} | 48 {% for constant in constants %} |
| 49 {% if constant.idl_type not in ('Double', 'Float', 'String') %} | 49 {% if constant.idl_type not in ('Double', 'Float', 'String') %} |
| 50 {% set constant_cpp_class = constant.cpp_class or cpp_class %} | 50 {% set constant_cpp_class = constant.cpp_class or cpp_class %} |
| 51 static_assert({{constant.value}} == {{constant_cpp_class}}::{{constant.reflected
_name}}, "the value of {{cpp_class}}_{{constant.reflected_name}} does not match
with implementation"); | 51 static_assert({{constant.value}} == {{constant_cpp_class}}::{{constant.reflected
_name}}, "the value of {{cpp_class}}_{{constant.reflected_name}} does not match
with implementation"); |
| 52 {% endif %} | 52 {% endif %} |
| 53 {% endfor %} | 53 {% endfor %} |
| 54 {% endif %} | 54 {% endif %} |
| 55 {% endmacro %} | 55 {% endmacro %} |
| 56 | 56 |
| 57 | 57 |
| 58 {######################################} | 58 {######################################} |
| 59 {%- macro constant_configuration(constant) %} | 59 {%- macro constant_configuration(constant) %} |
| 60 {% if constant.idl_type in ('Double', 'Float') %} | 60 {% if constant.idl_type in ('Double', 'Float') %} |
| 61 {% set value = '0, %s' % constant.value %} | 61 {% set value = '0, %s' % constant.value %} |
| 62 {% else %} | 62 {% else %} |
| 63 {# 'Short', 'Long' etc. #} | 63 {# 'Short', 'Long' etc. #} |
| 64 {% set value = '%s, 0' % constant.value %} | 64 {% set value = '%s, 0' % constant.value %} |
| 65 {% endif %} | 65 {% endif %} |
| 66 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} | 66 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} |
| 67 {%- endmacro %} | 67 {%- endmacro %} |
| OLD | NEW |