OLD | NEW |
---|---|
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %} | 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value %} |
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_ce_reactions %} | |
25 CEReactionsScope ceReactionsScope; | |
26 {% endif %} | |
24 {% if method.is_custom_element_callbacks %} | 27 {% if method.is_custom_element_callbacks %} |
25 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; | 28 V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; |
26 {% endif %} | 29 {% endif %} |
27 {# Security checks #} | 30 {# Security checks #} |
28 {% if method.is_check_security_for_receiver %} | 31 {% if method.is_check_security_for_receiver %} |
29 {% if interface_name == 'EventTarget' %} | 32 {% if interface_name == 'EventTarget' %} |
30 // Performance hack for EventTarget. Checking whether it's a Window or not | 33 // Performance hack for EventTarget. Checking whether it's a Window or not |
31 // prior to the call to BindingSecurity::shouldAllowAccessTo increases 30% | 34 // prior to the call to BindingSecurity::shouldAllowAccessTo increases 30% |
32 // of speed performance on Android Nexus 7 as of Dec 2015. ALWAYS_INLINE | 35 // of speed performance on Android Nexus 7 as of Dec 2015. ALWAYS_INLINE |
33 // didn't work in this case. | 36 // didn't work in this case. |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
482 return; | 485 return; |
483 // FIXME: Only pass context/exceptionState if instance really requires it. | 486 // FIXME: Only pass context/exceptionState if instance really requires it. |
484 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); | 487 ExecutionContext* context = currentExecutionContext(info.GetIsolate()); |
485 instance->postMessage(context, message.release(), transferables.messagePorts , exceptionState); | 488 instance->postMessage(context, message.release(), transferables.messagePorts , exceptionState); |
486 exceptionState.throwIfNeeded(); | 489 exceptionState.throwIfNeeded(); |
487 } | 490 } |
488 {% endmacro %} | 491 {% endmacro %} |
489 | 492 |
490 {##############################################################################} | 493 {##############################################################################} |
491 {% macro method_callback(method, world_suffix) %} | 494 {% macro method_callback(method, world_suffix) %} |
492 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) | 495 static void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCall backInfo<v8::Value>& info) |
Yuki
2016/06/07 08:16:57
Why don't you add CEReactionsScope to xxxMethodCal
kojii
2016/06/07 09:56:36
Done, agree we should, thank you for catching this
| |
493 { | 496 { |
494 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} | 497 {% if not method.overloads %}{# Overloaded methods are measured in overload_ resolution_method() #} |
495 {% if method.measure_as %} | 498 {% if method.measure_as %} |
496 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); | 499 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}}); |
497 {% endif %} | 500 {% endif %} |
498 {% if method.deprecate_as %} | 501 {% if method.deprecate_as %} |
499 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); | 502 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}}); |
500 {% endif %} | 503 {% endif %} |
501 {% endif %}{# not method.overloads #} | 504 {% endif %}{# not method.overloads #} |
502 {% if world_suffix in method.activity_logging_world_list %} | 505 {% if world_suffix in method.activity_logging_world_list %} |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
680 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all | 683 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all |
681 if method.overloads else | 684 if method.overloads else |
682 method.runtime_enabled_function) %} | 685 method.runtime_enabled_function) %} |
683 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; | 686 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; |
684 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); | 687 V8DOMConfiguration::installMethod(isolate, world, v8::Local<v8::Object>(), proto typeObject, interfaceObject, signature, {{method.name}}MethodConfiguration); |
685 {% endfilter %}{# runtime_enabled() #} | 688 {% endfilter %}{# runtime_enabled() #} |
686 {% endfilter %}{# exposed() #} | 689 {% endfilter %}{# exposed() #} |
687 {% endfor %} | 690 {% endfor %} |
688 {% endif %} | 691 {% endif %} |
689 {%- endmacro %} | 692 {%- endmacro %} |
OLD | NEW |