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

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

Issue 304223007: Use auto-rethrowing v8::TryCatch variant (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 {% endmacro %} 73 {% endmacro %}
74 74
75 75
76 {######################################} 76 {######################################}
77 {% macro generate_arguments(method, world_suffix) %} 77 {% macro generate_arguments(method, world_suffix) %}
78 {% for argument in method.arguments %} 78 {% for argument in method.arguments %}
79 {{generate_argument_var_declaration(argument)}}; 79 {{generate_argument_var_declaration(argument)}};
80 {% endfor %} 80 {% endfor %}
81 { 81 {
82 {% if method.arguments_need_try_catch %} 82 {% if method.arguments_need_try_catch %}
83 v8::TryCatch block; 83 V8TryPropagate block;
84 {% endif %} 84 {% endif %}
85 {% for argument in method.arguments %} 85 {% for argument in method.arguments %}
86 {{generate_argument(method, argument, world_suffix) | indent}} 86 {{generate_argument(method, argument, world_suffix) | indent}}
87 {% endfor %} 87 {% endfor %}
88 } 88 }
89 {% endmacro %} 89 {% endmacro %}
90 90
91 91
92 {######################################} 92 {######################################}
93 {% macro generate_argument_var_declaration(argument) %} 93 {% macro generate_argument_var_declaration(argument) %}
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 {######################################} 288 {######################################}
289 {% macro throw_type_error(method, error_message) %} 289 {% macro throw_type_error(method, error_message) %}
290 {% if method.has_exception_state %} 290 {% if method.has_exception_state %}
291 exceptionState.throwTypeError({{error_message}}); 291 exceptionState.throwTypeError({{error_message}});
292 {{throw_from_exception_state(method)}}; 292 {{throw_from_exception_state(method)}};
293 {% elif method.is_constructor %} 293 {% elif method.is_constructor %}
294 throwTypeError(ExceptionMessages::failedToConstruct("{{interface_name}}", {{erro r_message}}), info.GetIsolate()); 294 throwTypeError(ExceptionMessages::failedToConstruct("{{interface_name}}", {{erro r_message}}), info.GetIsolate());
295 {% else %}{# method.has_exception_state #} 295 {% else %}{# method.has_exception_state #}
296 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{interfac e_name}}", {{error_message}}), info.GetIsolate()); 296 throwTypeError(ExceptionMessages::failedToExecute("{{method.name}}", "{{interfac e_name}}", {{error_message}}), info.GetIsolate());
297 {% endif %} 297 {% endif %}
298 {% if method.arguments_need_try_catch %}
299 block.ReThrow();
300 {%- endif %}{# method.has_exception_state #}
301 {% endmacro %} 298 {% endmacro %}
302 299
303 300
304 {######################################} 301 {######################################}
305 {# FIXME: return a rejected Promise if method.idl_type == 'Promise' #} 302 {# FIXME: return a rejected Promise if method.idl_type == 'Promise' #}
306 {% macro throw_from_exception_state(method) %} 303 {% macro throw_from_exception_state(method) %}
307 exceptionState.throwIfNeeded() 304 exceptionState.throwIfNeeded()
308 {%- endmacro %} 305 {%- endmacro %}
309 306
310 307
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 {% endif %} 552 {% endif %}
556 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}}); 553 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons tructor.argument_list | join(', ')}});
557 {% if is_constructor_raises_exception %} 554 {% if is_constructor_raises_exception %}
558 if (exceptionState.throwIfNeeded()) 555 if (exceptionState.throwIfNeeded())
559 return; 556 return;
560 {% endif %} 557 {% endif %}
561 558
562 {{generate_constructor_wrapper(constructor) | indent}} 559 {{generate_constructor_wrapper(constructor) | indent}}
563 } 560 }
564 {% endmacro %} 561 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698