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

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

Issue 1035623002: bindings: Use Maybe APIs in ScriptPromise (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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 {% from 'conversions.cpp' import v8_value_to_local_cpp_value %} 1 {% from 'conversions.cpp' import v8_value_to_local_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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 {% endif %} 275 {% endif %}
276 {% endmacro %} 276 {% endmacro %}
277 277
278 278
279 {######################################} 279 {######################################}
280 {% macro throw_type_error(method, error_message) %} 280 {% macro throw_type_error(method, error_message) %}
281 {% if method.has_exception_state %} 281 {% if method.has_exception_state %}
282 exceptionState.throwTypeError({{error_message}}); 282 exceptionState.throwTypeError({{error_message}});
283 {{propagate_error_with_exception_state(method)}} 283 {{propagate_error_with_exception_state(method)}}
284 {% elif method.idl_type == 'Promise' %} 284 {% elif method.idl_type == 'Promise' %}
285 v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), V8ThrowExcept ion::createTypeError(info.GetIsolate(), {{type_error_message(method, error_messa ge)}}))); 285 v8SetReturnValue(info, ScriptPromise::rejectRaw(ScriptState::current(info.GetIso late()), V8ThrowException::createTypeError(info.GetIsolate(), {{type_error_messa ge(method, error_message)}})));
286 return; 286 return;
287 {% else %} 287 {% else %}
288 V8ThrowException::throwTypeError(info.GetIsolate(), {{type_error_message(method, error_message)}}); 288 V8ThrowException::throwTypeError(info.GetIsolate(), {{type_error_message(method, error_message)}});
289 return; 289 return;
290 {% endif %}{# method.has_exception_state #} 290 {% endif %}{# method.has_exception_state #}
291 {% endmacro %} 291 {% endmacro %}
292 292
293 293
294 {######################################} 294 {######################################}
295 {% macro type_error_message(method, error_message) %} 295 {% macro type_error_message(method, error_message) %}
(...skipping 15 matching lines...) Expand all
311 return; 311 return;
312 {%- endmacro %} 312 {%- endmacro %}
313 313
314 314
315 {######################################} 315 {######################################}
316 {% macro throw_minimum_arity_type_error(method, number_of_required_arguments) %} 316 {% macro throw_minimum_arity_type_error(method, number_of_required_arguments) %}
317 {% if method.has_exception_state %} 317 {% if method.has_exception_state %}
318 setMinimumArityTypeError(exceptionState, {{number_of_required_arguments}}, info. Length()); 318 setMinimumArityTypeError(exceptionState, {{number_of_required_arguments}}, info. Length());
319 {{propagate_error_with_exception_state(method)}} 319 {{propagate_error_with_exception_state(method)}}
320 {%- elif method.idl_type == 'Promise' %} 320 {%- elif method.idl_type == 'Promise' %}
321 v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), {{create_mini mum_arity_type_error_without_exception_state(method, number_of_required_argument s)}})); 321 v8SetReturnValue(info, ScriptPromise::rejectRaw(ScriptState::current(info.GetIso late()), {{create_minimum_arity_type_error_without_exception_state(method, numbe r_of_required_arguments)}}));
322 return; 322 return;
323 {%- else %} 323 {%- else %}
324 V8ThrowException::throwException({{create_minimum_arity_type_error_without_excep tion_state(method, number_of_required_arguments)}}, info.GetIsolate()); 324 V8ThrowException::throwException({{create_minimum_arity_type_error_without_excep tion_state(method, number_of_required_arguments)}}, info.GetIsolate());
325 return; 325 return;
326 {%- endif %} 326 {%- endif %}
327 {%- endmacro %} 327 {%- endmacro %}
328 328
329 329
330 {######################################} 330 {######################################}
331 {% macro create_minimum_arity_type_error_without_exception_state(method, number_ of_required_arguments) %} 331 {% macro create_minimum_arity_type_error_without_exception_state(method, number_ of_required_arguments) %}
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 if method.overloads else 653 if method.overloads else
654 method.runtime_enabled_function) %} 654 method.runtime_enabled_function) %}
655 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction()); 655 prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::Functio nTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}Metho dCallback, v8Undefined(), defaultSignature, {{method.number_of_required_argument s}})->GetFunction());
656 {% endfilter %}{# runtime_enabled() #} 656 {% endfilter %}{# runtime_enabled() #}
657 {% endfilter %}{# exposed() #} 657 {% endfilter %}{# exposed() #}
658 {% endfilter %}{# per_context_enabled() #} 658 {% endfilter %}{# per_context_enabled() #}
659 {% endfor %} 659 {% endfor %}
660 {% endif %} 660 {% endif %}
661 } 661 }
662 {%- endmacro %} 662 {%- endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/core/v8/ScriptValue.h ('k') | Source/bindings/tests/results/core/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698