| 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 17 matching lines...) Expand all Loading... |
| 28 {% if constant_configuration_constants %} | 28 {% if constant_configuration_constants %} |
| 29 {# Normal constants #} | 29 {# Normal constants #} |
| 30 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] =
{ | 30 static const V8DOMConfiguration::ConstantConfiguration {{v8_class}}Constants[] =
{ |
| 31 {% for constant in constant_configuration_constants %} | 31 {% for constant in constant_configuration_constants %} |
| 32 {{constant_configuration(constant)}}, | 32 {{constant_configuration(constant)}}, |
| 33 {% endfor %} | 33 {% endfor %} |
| 34 }; | 34 }; |
| 35 V8DOMConfiguration::installConstants(isolate, functionTemplate, prototypeTemplat
e, {{v8_class}}Constants, WTF_ARRAY_LENGTH({{v8_class}}Constants)); | 35 V8DOMConfiguration::installConstants(isolate, functionTemplate, prototypeTemplat
e, {{v8_class}}Constants, WTF_ARRAY_LENGTH({{v8_class}}Constants)); |
| 36 {% endif %} | 36 {% endif %} |
| 37 {# Runtime-enabled constants #} | 37 {# Runtime-enabled constants #} |
| 38 {% for constant in runtime_enabled_constants %} | 38 {% for constant_tuple in runtime_enabled_constants %} |
| 39 {% filter runtime_enabled(constant.runtime_enabled_function) %} | 39 {% filter runtime_enabled(constant_tuple[0]) %} |
| 40 static const V8DOMConfiguration::ConstantConfiguration constantConfiguration = {
{constant_configuration(constant)}}; | 40 {% for constant in constant_tuple[1] %} |
| 41 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate
, constantConfiguration); | 41 {% set constant_name = constant.name.title().replace('_', '') %} |
| 42 static const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}
Configuration = {{constant_configuration(constant)}}; |
| 43 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate
, constant{{constant_name}}Configuration); |
| 44 {% endfor %} |
| 42 {% endfilter %} | 45 {% endfilter %} |
| 43 {% endfor %} | 46 {% endfor %} |
| 44 {# Constants with [DeprecateAs] or [MeasureAs] #} | 47 {# Constants with [DeprecateAs] or [MeasureAs] #} |
| 45 {% for constant in special_getter_constants %} | 48 {% for constant in special_getter_constants %} |
| 46 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); |
| 47 {% endfor %} | 50 {% endfor %} |
| 48 {# Check constants #} | 51 {# Check constants #} |
| 49 {% if not do_not_check_constants %} | 52 {% if not do_not_check_constants %} |
| 50 {% for constant in constants %} | 53 {% for constant in constants %} |
| 51 {% if constant.idl_type not in ('Double', 'Float', 'String') %} | 54 {% if constant.idl_type not in ('Double', 'Float', 'String') %} |
| 52 {% set constant_cpp_class = constant.cpp_class or cpp_class %} | 55 {% set constant_cpp_class = constant.cpp_class or cpp_class %} |
| 53 static_assert({{constant.value}} == {{constant_cpp_class}}::{{constant.reflected
_name}}, "the value of {{cpp_class}}_{{constant.reflected_name}} does not match
with implementation"); | 56 static_assert({{constant.value}} == {{constant_cpp_class}}::{{constant.reflected
_name}}, "the value of {{cpp_class}}_{{constant.reflected_name}} does not match
with implementation"); |
| 54 {% endif %} | 57 {% endif %} |
| 55 {% endfor %} | 58 {% endfor %} |
| 56 {% endif %} | 59 {% endif %} |
| 57 {% endmacro %} | 60 {% endmacro %} |
| 58 | 61 |
| 59 | 62 |
| 60 {######################################} | 63 {######################################} |
| 61 {%- macro constant_configuration(constant) %} | 64 {%- macro constant_configuration(constant) %} |
| 62 {% if constant.idl_type in ('Double', 'Float') %} | 65 {% if constant.idl_type in ('Double', 'Float') %} |
| 63 {% set value = '0, %s' % constant.value %} | 66 {% set value = '0, %s' % constant.value %} |
| 64 {% else %} | 67 {% else %} |
| 65 {# 'Short', 'Long' etc. #} | 68 {# 'Short', 'Long' etc. #} |
| 66 {% set value = '%s, 0' % constant.value %} | 69 {% set value = '%s, 0' % constant.value %} |
| 67 {% endif %} | 70 {% endif %} |
| 68 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} | 71 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} |
| 69 {%- endmacro %} | 72 {%- endmacro %} |
| OLD | NEW |