| OLD | NEW |
| 1 {##############################################################################} | 1 {##############################################################################} |
| 2 {% macro constant_getter_callback(constant) %} | 2 {% macro constant_getter_callback(constant) %} |
| 3 {% filter conditional(constant.conditional_string) %} | 3 {% filter conditional(constant.conditional_string) %} |
| 4 static void {{constant.name}}ConstantGetterCallback(v8::Local<v8::Name>, const v
8::PropertyCallbackInfo<v8::Value>& info) | 4 static void {{constant.name}}ConstantGetterCallback(v8::Local<v8::Name>, const v
8::PropertyCallbackInfo<v8::Value>& info) |
| 5 { | 5 { |
| 6 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 6 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
| 7 {% if constant.deprecate_as %} | 7 {% if constant.deprecate_as %} |
| 8 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{constant.deprecate_as}}); | 8 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{constant.deprecate_as}}); |
| 9 {% endif %} | 9 {% endif %} |
| 10 {% if constant.measure_as %} | 10 {% if constant.measure_as %} |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 {% set constant_name = constant.name.title().replace('_', '') %} | 41 {% set constant_name = constant.name.title().replace('_', '') %} |
| 42 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configu
ration = {{constant_configuration(constant)}}; | 42 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configu
ration = {{constant_configuration(constant)}}; |
| 43 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate
, constant{{constant_name}}Configuration); | 43 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate
, constant{{constant_name}}Configuration); |
| 44 {% endfor %} | 44 {% endfor %} |
| 45 {% endfilter %} | 45 {% endfilter %} |
| 46 {% endfor %} | 46 {% endfor %} |
| 47 {# Constants with [DeprecateAs] or [MeasureAs] #} | 47 {# Constants with [DeprecateAs] or [MeasureAs] #} |
| 48 {% for constant in special_getter_constants %} | 48 {% for constant in special_getter_constants %} |
| 49 V8DOMConfiguration::installConstantWithGetter(isolate, functionTemplate, prototy
peTemplate, "{{constant.name}}", {{cpp_class}}V8Internal::{{constant.name}}Const
antGetterCallback); | 49 V8DOMConfiguration::installConstantWithGetter(isolate, functionTemplate, prototy
peTemplate, "{{constant.name}}", {{cpp_class}}V8Internal::{{constant.name}}Const
antGetterCallback); |
| 50 {% endfor %} | 50 {% endfor %} |
| 51 {# Constants with [ExperimentEnabled] only #} |
| 52 {% for constant in experimental_only_constants %} |
| 53 if (Experiments::isApiEnabled(ec, "{{constant['api_experiment_name']}}")) { |
| 54 const V8DOMConfiguration::ConstantConfiguration constant{{constant.name}}Con
figuration = {{constant_configuration(constant)}}; |
| 55 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemp
late, constant{{constant.name}}Configuration); |
| 56 } |
| 57 {% endfor %} |
| 51 {# Check constants #} | 58 {# Check constants #} |
| 52 {% if not do_not_check_constants %} | 59 {% if not do_not_check_constants %} |
| 53 {% for constant in constants %} | 60 {% for constant in constants %} |
| 54 {% if constant.idl_type not in ('Double', 'Float', 'String') %} | 61 {% if constant.idl_type not in ('Double', 'Float', 'String') %} |
| 55 {% set constant_cpp_class = constant.cpp_class or cpp_class %} | 62 {% set constant_cpp_class = constant.cpp_class or cpp_class %} |
| 56 static_assert({{constant.value}} == {{constant_cpp_class}}::{{constant.reflected
_name}}, "the value of {{cpp_class}}_{{constant.reflected_name}} does not match
with implementation"); | 63 static_assert({{constant.value}} == {{constant_cpp_class}}::{{constant.reflected
_name}}, "the value of {{cpp_class}}_{{constant.reflected_name}} does not match
with implementation"); |
| 57 {% endif %} | 64 {% endif %} |
| 58 {% endfor %} | 65 {% endfor %} |
| 59 {% endif %} | 66 {% endif %} |
| 60 {% endmacro %} | 67 {% endmacro %} |
| 61 | 68 |
| 62 | 69 |
| 63 {######################################} | 70 {######################################} |
| 64 {%- macro constant_configuration(constant) %} | 71 {%- macro constant_configuration(constant) %} |
| 65 {% if constant.idl_type in ('Double', 'Float') %} | 72 {% if constant.idl_type in ('Double', 'Float') %} |
| 66 {% set value = '0, %s' % constant.value %} | 73 {% set value = '0, %s' % constant.value %} |
| 67 {% else %} | 74 {% else %} |
| 68 {# 'Short', 'Long' etc. #} | 75 {# 'Short', 'Long' etc. #} |
| 69 {% set value = '%s, 0' % constant.value %} | 76 {% set value = '%s, 0' % constant.value %} |
| 70 {% endif %} | 77 {% endif %} |
| 71 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} | 78 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} |
| 72 {%- endmacro %} | 79 {%- endmacro %} |
| OLD | NEW |