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

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

Issue 709743002: Move the v8::Isolate* parameter to the first parameter of various binding methods in third_party/We… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 276
277 277
278 {######################################} 278 {######################################}
279 {% macro throw_type_error(method, error_message) %} 279 {% macro throw_type_error(method, error_message) %}
280 {% if method.has_exception_state %} 280 {% if method.has_exception_state %}
281 exceptionState.throwTypeError({{error_message}}); 281 exceptionState.throwTypeError({{error_message}});
282 {{throw_from_exception_state(method)}}; 282 {{throw_from_exception_state(method)}};
283 {% elif method.idl_type == 'Promise' %} 283 {% elif method.idl_type == 'Promise' %}
284 v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), V8ThrowExcept ion::createTypeError(info.GetIsolate(), {{type_error_message(method, error_messa ge)}}))); 284 v8SetReturnValue(info, ScriptPromise::rejectRaw(info.GetIsolate(), V8ThrowExcept ion::createTypeError(info.GetIsolate(), {{type_error_message(method, error_messa ge)}})));
285 {% else %} 285 {% else %}
286 V8ThrowException::throwTypeError({{type_error_message(method, error_message)}}, info.GetIsolate()); 286 V8ThrowException::throwTypeError(info.GetIsolate(), {{type_error_message(method, error_message)}});
287 {% endif %}{# method.has_exception_state #} 287 {% endif %}{# method.has_exception_state #}
288 {% endmacro %} 288 {% endmacro %}
289 289
290 290
291 {######################################} 291 {######################################}
292 {% macro type_error_message(method, error_message) %} 292 {% macro type_error_message(method, error_message) %}
293 {% if method.is_constructor %} 293 {% if method.is_constructor %}
294 ExceptionMessages::failedToConstruct("{{interface_name}}", {{error_message}}) 294 ExceptionMessages::failedToConstruct("{{interface_name}}", {{error_message}})
295 {%- else %} 295 {%- else %}
296 ExceptionMessages::failedToExecute("{{method.name}}", "{{interface_name}}", {{er ror_message}}) 296 ExceptionMessages::failedToExecute("{{method.name}}", "{{interface_name}}", {{er ror_message}})
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 533
534 {##############################################################################} 534 {##############################################################################}
535 {% macro generate_constructor(constructor) %} 535 {% macro generate_constructor(constructor) %}
536 {% set name = '%sConstructorCallback' % v8_class 536 {% set name = '%sConstructorCallback' % v8_class
537 if constructor.is_named_constructor else 537 if constructor.is_named_constructor else
538 'constructor%s' % (constructor.overload_index or '') %} 538 'constructor%s' % (constructor.overload_index or '') %}
539 static void {{name}}(const v8::FunctionCallbackInfo<v8::Value>& info) 539 static void {{name}}(const v8::FunctionCallbackInfo<v8::Value>& info)
540 { 540 {
541 {% if constructor.is_named_constructor %} 541 {% if constructor.is_named_constructor %}
542 if (!info.IsConstructCall()) { 542 if (!info.IsConstructCall()) {
543 V8ThrowException::throwTypeError(ExceptionMessages::constructorNotCallab leAsFunction("{{constructor.name}}"), info.GetIsolate()); 543 V8ThrowException::throwTypeError(info.GetIsolate(), ExceptionMessages::c onstructorNotCallableAsFunction("{{constructor.name}}"));
544 return; 544 return;
545 } 545 }
546 546
547 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) { 547 if (ConstructorMode::current(info.GetIsolate()) == ConstructorMode::WrapExis tingObject) {
548 v8SetReturnValue(info, info.Holder()); 548 v8SetReturnValue(info, info.Holder());
549 return; 549 return;
550 } 550 }
551 {% endif %} 551 {% endif %}
552 {% if constructor.has_exception_state %} 552 {% if constructor.has_exception_state %}
553 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf ace_name}}", info.Holder(), info.GetIsolate()); 553 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf ace_name}}", info.Holder(), info.GetIsolate());
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 {% for method in conditionally_enabled_methods %} 629 {% for method in conditionally_enabled_methods %}
630 {% filter per_context_enabled(method.per_context_enabled_function) %} 630 {% filter per_context_enabled(method.per_context_enabled_function) %}
631 {% filter exposed(method.exposed_test) %} 631 {% filter exposed(method.exposed_test) %}
632 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()); 632 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());
633 {% endfilter %} 633 {% endfilter %}
634 {% endfilter %} 634 {% endfilter %}
635 {% endfor %} 635 {% endfor %}
636 {% endif %} 636 {% endif %}
637 } 637 }
638 {%- endmacro %} 638 {%- endmacro %}
OLDNEW
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/results/core/V8TestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698