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

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

Issue 611453002: IDL: Clean up argument conversion error handling (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 {% endfilter %} 56 {% endfilter %}
57 {% endmacro %} 57 {% endmacro %}
58 58
59 59
60 {######################################} 60 {######################################}
61 {% macro generate_arguments(method, world_suffix) %} 61 {% macro generate_arguments(method, world_suffix) %}
62 {% for argument in method.arguments %} 62 {% for argument in method.arguments %}
63 {{generate_argument_var_declaration(argument)}}; 63 {{generate_argument_var_declaration(argument)}};
64 {% endfor %} 64 {% endfor %}
65 { 65 {
66 {% if method.arguments_need_try_catch %}
67 v8::TryCatch block;
68 V8RethrowTryCatchScope rethrow(block);
69 {% endif %}
70 {% for argument in method.arguments %} 66 {% for argument in method.arguments %}
71 {% if argument.default_value %} 67 {% if argument.default_value %}
72 if (!info[{{argument.index}}]->IsUndefined()) { 68 if (!info[{{argument.index}}]->IsUndefined()) {
73 {{generate_argument(method, argument, world_suffix) | indent(8)}} 69 {{generate_argument(method, argument, world_suffix) | indent(8)}}
74 } else { 70 } else {
75 {{argument.name}} = {{argument.default_value}}; 71 {{argument.name}} = {{argument.default_value}};
76 } 72 }
77 {% else %} 73 {% else %}
78 {{generate_argument(method, argument, world_suffix) | indent}} 74 {{generate_argument(method, argument, world_suffix) | indent}}
79 {% endif %} 75 {% endif %}
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 if method.is_per_world_bindings else '0' %} 616 if method.is_per_world_bindings else '0' %}
621 {% set property_attribute = 617 {% set property_attribute =
622 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es) 618 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es)
623 if method.property_attributes else 'v8::None' %} 619 if method.property_attributes else 'v8::None' %}
624 {% 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' %}
625 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { 621 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = {
626 "{{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}},
627 }; 623 };
628 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);
629 {%- endmacro %} 625 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698