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

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

Issue 611953003: Canvas2D Performance: fix the bottleneck of hasInstance during JS binding -- overloading (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add code change in Source/bindings/tests/results/ Created 6 years, 2 months 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
OLDNEW
1 {##############################################################################} 1 {##############################################################################}
2 {% macro generate_method(method, world_suffix) %} 2 {% macro generate_method(method, world_suffix) %}
3 {% filter conditional(method.conditional_string) %} 3 {% filter conditional(method.conditional_string) %}
4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) 4 static void {{method.name}}{{method.overload_index}}Method{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info)
5 { 5 {
6 {# Local variables #} 6 {# Local variables #}
7 {% if method.has_exception_state %} 7 {% if method.has_exception_state %}
8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate()); 8 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{interface_name}}", info.Holder(), info.GetIsolate());
9 {% endif %} 9 {% endif %}
10 {# Overloaded methods have length checked during overload resolution #} 10 {# Overloaded methods have length checked during overload resolution #}
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum ent.cpp_value) | indent}} 102 {{cpp_method_call(method, argument.v8_set_return_value_for_main_world, argum ent.cpp_value) | indent}}
103 {% else %} 103 {% else %}
104 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}} 104 {{cpp_method_call(method, argument.v8_set_return_value, argument.cpp_value) | indent}}
105 {% endif %} 105 {% endif %}
106 {% if argument.has_event_listener_argument %} 106 {% if argument.has_event_listener_argument %}
107 {{hidden_dependency_action(method.name) | indent}} 107 {{hidden_dependency_action(method.name) | indent}}
108 {% endif %} 108 {% endif %}
109 return; 109 return;
110 } 110 }
111 {% endif %} 111 {% endif %}
112 {% if argument.has_type_checking_interface and not argument.is_variadic_wrapper_ type %} 112 {% if argument.has_type_checking_interface and not argument.is_variadic_wrapper_ type and not argument.type_checked_already %}
113 {# Type checking for wrapper interface types (if interface not implemented, 113 {# Type checking for wrapper interface types (if interface not implemented,
114 throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface 114 throw a TypeError), per http://www.w3.org/TR/WebIDL/#es-interface
115 Note: for variadic arguments, the type checking is done for each matched 115 Note: for variadic arguments, the type checking is done for each matched
116 argument instead; see argument.is_variadic_wrapper_type code-path below. #} 116 argument instead; see argument.is_variadic_wrapper_type code-path below. #}
117 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI nstance(info[{{argument.index}}], info.GetIsolate())) { 117 if (info.Length() > {{argument.index}} && {% if argument.is_nullable %}!isUndefi nedOrNull(info[{{argument.index}}]) && {% endif %}!V8{{argument.idl_type}}::hasI nstance(info[{{argument.index}}], info.GetIsolate())) {
118 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' % 118 {{throw_type_error(method, '"parameter %s is not of type \'%s\'."' %
119 (argument.index + 1, argument.idl_type)) | indent }} 119 (argument.index + 1, argument.idl_type)) | indent }}
120 return; 120 return;
121 } 121 }
122 {% endif %}{# argument.has_type_checking_interface #} 122 {% endif %}{# argument.has_type_checking_interface #}
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 if method.is_per_world_bindings else '0' %} 616 if method.is_per_world_bindings else '0' %}
617 {% set property_attribute = 617 {% set property_attribute =
618 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es) 618 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es)
619 if method.property_attributes else 'v8::None' %} 619 if method.property_attributes else 'v8::None' %}
620 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} 620 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %}
621 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { 621 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = {
622 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, 622 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}},
623 }; 623 };
624 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); 624 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate);
625 {%- endmacro %} 625 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698