Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: third_party/WebKit/Source/bindings/templates/methods.cpp

Issue 1494803003: bindings: Improves the speed perf of EventTarget.dispatchEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l ocal_cpp_value %} 1 {% from 'conversions.cpp' import declare_enum_validation_variable, v8_value_to_l ocal_cpp_value %}
2 2
3 3
4 {##############################################################################} 4 {##############################################################################}
5 {% macro generate_method(method, world_suffix) %} 5 {% macro generate_method(method, world_suffix) %}
6 {% filter conditional(method.conditional_string) %} 6 {% filter conditional(method.conditional_string) %}
7 {% if method.returns_promise and method.has_exception_state %} 7 {% if method.returns_promise and method.has_exception_state %}
8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e) 8 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}Promis e(const v8::FunctionCallbackInfo<v8::Value>& info, ExceptionState& exceptionStat e)
9 {% else %} 9 {% else %}
10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 10 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 10 matching lines...) Expand all
21 } 21 }
22 {% endif %} 22 {% endif %}
23 {% if not method.is_static %} 23 {% if not method.is_static %}
24 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder()); 24 {{cpp_class}}* impl = {{v8_class}}::toImpl(info.Holder());
25 {% endif %} 25 {% endif %}
26 {% if method.is_custom_element_callbacks %} 26 {% if method.is_custom_element_callbacks %}
27 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; 27 CustomElementProcessingStack::CallbackDeliveryScope deliveryScope;
28 {% endif %} 28 {% endif %}
29 {# Security checks #} 29 {# Security checks #}
30 {% if method.is_check_security_for_receiver %} 30 {% if method.is_check_security_for_receiver %}
31 {% if interface_name == 'EventTarget' %}
32 // Performance hack for EventTarget. Checking whether it's a Window or not
33 // prior to the call to BindingSecurity::shouldAllowAccessTo increases 30%
34 // of speed performance on Android Nexus 7 as of Dec 2016. ALWAYS_INLINE
35 // didn't work in this case.
36 if (LocalDOMWindow* window = impl->toDOMWindow()) {
37 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMW indow(info.GetIsolate()), window, exceptionState)) {
38 {% if not method.returns_promise %}
39 exceptionState.throwIfNeeded();
40 {% endif %}
41 return;
42 }
43 }
44 {% else %}{# interface_name == 'EventTarget' #}
31 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo w(info.GetIsolate()), impl, exceptionState)) { 45 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo w(info.GetIsolate()), impl, exceptionState)) {
32 {% if not method.returns_promise %} 46 {% if not method.returns_promise %}
33 exceptionState.throwIfNeeded(); 47 exceptionState.throwIfNeeded();
34 {% endif %} 48 {% endif %}
35 return; 49 return;
36 } 50 }
51 {% endif %}{# interface_name == 'EventTarget' #}
37 {% endif %} 52 {% endif %}
38 {% if method.is_check_security_for_return_value %} 53 {% if method.is_check_security_for_return_value %}
39 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo w(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) { 54 if (!BindingSecurity::shouldAllowAccessTo(info.GetIsolate(), callingDOMWindo w(info.GetIsolate()), {{method.cpp_value}}, exceptionState)) {
40 v8SetReturnValueNull(info); 55 v8SetReturnValueNull(info);
41 {% if not method.returns_promise %} 56 {% if not method.returns_promise %}
42 exceptionState.throwIfNeeded(); 57 exceptionState.throwIfNeeded();
43 {% endif %} 58 {% endif %}
44 return; 59 return;
45 } 60 }
46 {% endif %} 61 {% endif %}
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all 707 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
693 if method.overloads else 708 if method.overloads else
694 method.runtime_enabled_function) %} 709 method.runtime_enabled_function) %}
695 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}}; 710 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
696 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration); 711 V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObj ect, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration);
697 {% endfilter %}{# runtime_enabled() #} 712 {% endfilter %}{# runtime_enabled() #}
698 {% endfilter %}{# exposed() #} 713 {% endfilter %}{# exposed() #}
699 {% endfor %} 714 {% endfor %}
700 {% endif %} 715 {% endif %}
701 {%- endmacro %} 716 {%- endmacro %}
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698