OLD | NEW |
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_origin_trial %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc
al_cpp_value, check_origin_trial %} |
2 | 2 |
3 {##############################################################################} | 3 {##############################################################################} |
4 {% macro generate_method(method, world_suffix) %} | 4 {% macro generate_method(method, world_suffix) %} |
5 {% if method.returns_promise and method.has_exception_state %} | 5 {% if method.returns_promise and method.has_exception_state %} |
6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) | 6 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis
e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat
e) |
7 {% else %} | 7 {% else %} |
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) | 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const
v8::FunctionCallbackInfo<v8::Value>& info) |
9 {% endif %} | 9 {% endif %} |
10 { | 10 { |
11 {# Local variables #} | 11 {# Local variables #} |
12 {% if method.has_exception_state and not method.returns_promise %} | 12 {% if method.has_exception_state and not method.returns_promise %} |
13 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); | 13 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); |
14 {% endif %} | 14 {% endif %} |
15 {# Overloaded methods have length checked during overload resolution #} | 15 {# Overloaded methods have length checked during overload resolution #} |
16 {% if method.number_of_required_arguments and not method.overload_index %} | 16 {% if method.number_of_required_arguments and not method.overload_index %} |
17 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { | 17 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { |
18 {{throw_minimum_arity_type_error(method, method.number_of_required_argum
ents) | indent(8)}} | 18 {{throw_minimum_arity_type_error(method, method.number_of_required_argum
ents) | indent(8)}} |
19 } | 19 } |
20 {% endif %} | 20 {% endif %} |
21 {% if not method.is_static %} | 21 {% if not method.is_static %} |
22 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); | 22 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); |
23 {% endif %} | 23 {% endif %} |
24 {% if method.is_custom_element_callbacks %} | 24 {% if method.is_custom_element_callbacks %} |
25 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 25 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
26 {% endif %} | 26 {% endif %} |
27 {# Security checks #} | 27 {# Security checks #} |
28 {% if method.is_check_security_for_receiver %} | 28 {% if method.is_check_security_for_receiver %} |
29 {% if interface_name == 'EventTarget' %} | 29 {% if interface_name == 'EventTarget' %} |
30 // Performance hack for EventTarget. Checking whether it's a Window or not | 30 // Performance hack for EventTarget. Checking whether it's a Window or not |
31 // prior to the call to BindingSecurity::shouldAllowAccessTo increases 30% | 31 // prior to the call to BindingSecurity::shouldAllowAccessTo increases 30% |
32 // of speed performance on Android Nexus 7 as of Dec 2016. ALWAYS_INLINE | 32 // of speed performance on Android Nexus 7 as of Dec 2016. ALWAYS_INLINE |
33 // didn't work in this case. | 33 // didn't work in this case. |
34 if (LocalDOMWindow* window = impl->toLocalDOMWindow()) { | 34 if (LocalDOMWindow* window = impl->toLocalDOMWindow()) { |
35 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMW
indow(info.GetIsolate()), window, exceptionState)) { | 35 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMW
indow(info.GetIsolate()), window, exceptionState)) { |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all | 688 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all |
689 if method.overloads else | 689 if method.overloads else |
690 method.runtime_enabled_function) %} | 690 method.runtime_enabled_function) %} |
691 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; | 691 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration
= {{method_configuration(method)}}; |
692 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); | 692 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto
typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); |
693 {% endfilter %}{# runtime_enabled() #} | 693 {% endfilter %}{# runtime_enabled() #} |
694 {% endfilter %}{# exposed() #} | 694 {% endfilter %}{# exposed() #} |
695 {% endfor %} | 695 {% endfor %} |
696 {% endif %} | 696 {% endif %} |
697 {%- endmacro %} | 697 {%- endmacro %} |
OLD | NEW |