OLD | NEW |
| 1 {% from 'utilities.cpp' import check_api_experiment %} |
| 2 |
1 {##############################################################################} | 3 {##############################################################################} |
2 {% macro constant_getter_callback(constant) %} | 4 {% macro constant_getter_callback(constant) %} |
3 {% filter conditional(constant.conditional_string) %} | 5 {% filter conditional(constant.conditional_string) %} |
4 static void {{constant.name}}ConstantGetterCallback(v8::Local<v8::Name>, const v
8::PropertyCallbackInfo<v8::Value>& info) | 6 static void {{constant.name}}ConstantGetterCallback(v8::Local<v8::Name>, const v
8::PropertyCallbackInfo<v8::Value>& info) |
5 { | 7 { |
6 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); | 8 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMGetter"); |
7 {% if constant.deprecate_as %} | 9 {% if constant.deprecate_as %} |
8 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{constant.deprecate_as}}); | 10 UseCounter::countDeprecationIfNotPrivateScript(info.GetIsolate(), callingExe
cutionContext(info.GetIsolate()), UseCounter::{{constant.deprecate_as}}); |
9 {% endif %} | 11 {% endif %} |
10 {% if constant.measure_as %} | 12 {% if constant.measure_as %} |
11 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{constant.measure_as('ConstantGetter')}}); | 13 UseCounter::countIfNotPrivateScript(info.GetIsolate(), callingExecutionConte
xt(info.GetIsolate()), UseCounter::{{constant.measure_as('ConstantGetter')}}); |
12 {% endif %} | 14 {% endif %} |
| 15 {% if constant.is_api_experiment_enabled %} |
| 16 {{check_api_experiment(constant) | indent}} |
| 17 {% endif %} |
13 {% if constant.idl_type in ('Double', 'Float') %} | 18 {% if constant.idl_type in ('Double', 'Float') %} |
14 v8SetReturnValue(info, {{constant.value}}); | 19 v8SetReturnValue(info, {{constant.value}}); |
15 {% elif constant.idl_type == 'String' %} | 20 {% elif constant.idl_type == 'String' %} |
16 v8SetReturnValueString(info, "{{constant.value}}"); | 21 v8SetReturnValueString(info, "{{constant.value}}"); |
17 {% else %} | 22 {% else %} |
18 v8SetReturnValueInt(info, {{constant.value}}); | 23 v8SetReturnValueInt(info, {{constant.value}}); |
19 {% endif %} | 24 {% endif %} |
20 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); | 25 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
21 } | 26 } |
22 {% endfilter %} | 27 {% endfilter %} |
(...skipping 14 matching lines...) Expand all Loading... |
37 {# Runtime-enabled constants #} | 42 {# Runtime-enabled constants #} |
38 {% for constant_tuple in runtime_enabled_constants %} | 43 {% for constant_tuple in runtime_enabled_constants %} |
39 {% filter runtime_enabled(constant_tuple[0]) %} | 44 {% filter runtime_enabled(constant_tuple[0]) %} |
40 {% for constant in constant_tuple[1] %} | 45 {% for constant in constant_tuple[1] %} |
41 {% set constant_name = constant.name.title().replace('_', '') %} | 46 {% set constant_name = constant.name.title().replace('_', '') %} |
42 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configu
ration = {{constant_configuration(constant)}}; | 47 const V8DOMConfiguration::ConstantConfiguration constant{{constant_name}}Configu
ration = {{constant_configuration(constant)}}; |
43 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate
, constant{{constant_name}}Configuration); | 48 V8DOMConfiguration::installConstant(isolate, functionTemplate, prototypeTemplate
, constant{{constant_name}}Configuration); |
44 {% endfor %} | 49 {% endfor %} |
45 {% endfilter %} | 50 {% endfilter %} |
46 {% endfor %} | 51 {% endfor %} |
47 {# Constants with [DeprecateAs] or [MeasureAs] #} | 52 {# Constants with [DeprecateAs] or [MeasureAs] or [APIExperimentEnabled] #} |
48 {% for constant in special_getter_constants %} | 53 {% for constant in special_getter_constants %} |
49 V8DOMConfiguration::installConstantWithGetter(isolate, functionTemplate, prototy
peTemplate, "{{constant.name}}", {{cpp_class}}V8Internal::{{constant.name}}Const
antGetterCallback); | 54 V8DOMConfiguration::installConstantWithGetter(isolate, functionTemplate, prototy
peTemplate, "{{constant.name}}", {{cpp_class}}V8Internal::{{constant.name}}Const
antGetterCallback); |
50 {% endfor %} | 55 {% endfor %} |
51 {# Check constants #} | 56 {# Check constants #} |
52 {% if not do_not_check_constants %} | 57 {% if not do_not_check_constants %} |
53 {% for constant in constants %} | 58 {% for constant in constants %} |
54 {% if constant.idl_type not in ('Double', 'Float', 'String') %} | 59 {% if constant.idl_type not in ('Double', 'Float', 'String') %} |
55 {% set constant_cpp_class = constant.cpp_class or cpp_class %} | 60 {% 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"); | 61 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 %} | 62 {% endif %} |
58 {% endfor %} | 63 {% endfor %} |
59 {% endif %} | 64 {% endif %} |
60 {% endmacro %} | 65 {% endmacro %} |
61 | 66 |
62 | 67 |
63 {######################################} | 68 {######################################} |
64 {%- macro constant_configuration(constant) %} | 69 {%- macro constant_configuration(constant) %} |
65 {% if constant.idl_type in ('Double', 'Float') %} | 70 {% if constant.idl_type in ('Double', 'Float') %} |
66 {% set value = '0, %s' % constant.value %} | 71 {% set value = '0, %s' % constant.value %} |
67 {% else %} | 72 {% else %} |
68 {# 'Short', 'Long' etc. #} | 73 {# 'Short', 'Long' etc. #} |
69 {% set value = '%s, 0' % constant.value %} | 74 {% set value = '%s, 0' % constant.value %} |
70 {% endif %} | 75 {% endif %} |
71 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} | 76 {"{{constant.name}}", {{value}}, V8DOMConfiguration::ConstantType{{constant.idl_
type}}} |
72 {%- endmacro %} | 77 {%- endmacro %} |
OLD | NEW |