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

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

Issue 105693002: Generate a bit less code to handle failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 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
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 {% if method.is_raises_exception or method.is_check_security_for_frame or 6 {% if method.is_raises_exception or method.is_check_security_for_frame or
7 method.name in ['addEventListener', 'removeEventListener'] %} 7 method.name in ['addEventListener', 'removeEventListener'] %}
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 {% if method.name in ['addEventListener', 'removeEventListener'] %} 10 {% if method.name in ['addEventListener', 'removeEventListener'] %}
11 {{add_remove_event_listener_method(method.name) | indent}} 11 {{add_remove_event_listener_method(method.name) | indent}}
12 {% else %} 12 {% else %}
13 {% if method.number_of_required_arguments %} 13 {% if method.number_of_required_arguments %}
14 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) { 14 if (UNLIKELY(info.Length() < {{method.number_of_required_arguments}})) {
15 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{ interface_name}}", ExceptionMessages::notEnoughArguments({{method.number_of_requ ired_arguments}}, info.Length())), info.GetIsolate()); 15 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments({{me thod.number_of_required_arguments}}, info.Length()));
16 exceptionState.throwIfNeeded();
16 return; 17 return;
17 } 18 }
18 {% endif %} 19 {% endif %}
19 {% if not method.is_static %} 20 {% if not method.is_static %}
20 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder()); 21 {{cpp_class}}* imp = {{v8_class}}::toNative(info.Holder());
21 {% endif %} 22 {% endif %}
22 {% if method.is_custom_element_callbacks %} 23 {% if method.is_custom_element_callbacks %}
23 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 24 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
24 {% endif %} 25 {% endif %}
25 {% if method.is_check_security_for_frame %} 26 {% if method.is_check_security_for_frame %}
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 v8SetReturnValue(info, privateTemplate->GetFunction()); 254 v8SetReturnValue(info, privateTemplate->GetFunction());
254 } 255 }
255 256
256 static void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Lo cal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) 257 static void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Lo cal<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info)
257 { 258 {
258 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); 259 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter");
259 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix }}(info); 260 {{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix }}(info);
260 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 261 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
261 } 262 }
262 {% endmacro %} 263 {% endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/scripts/code_generator_v8.pm ('k') | Source/bindings/tests/results/V8SupportTestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698