| OLD | NEW |
| 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 {% endmacro %} | 228 {% endmacro %} |
| 229 | 229 |
| 230 | 230 |
| 231 {######################################} | 231 {######################################} |
| 232 {% macro cpp_method_call(method, v8_set_return_value, cpp_value) %} | 232 {% macro cpp_method_call(method, v8_set_return_value, cpp_value) %} |
| 233 {# Local variables #} | 233 {# Local variables #} |
| 234 {% if method.is_call_with_script_state %} | 234 {% if method.is_call_with_script_state %} |
| 235 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); | 235 ScriptState* scriptState = ScriptState::current(info.GetIsolate()); |
| 236 {% endif %} | 236 {% endif %} |
| 237 {% if method.is_call_with_execution_context %} | 237 {% if method.is_call_with_execution_context %} |
| 238 ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()); | 238 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate()); |
| 239 {% endif %} | 239 {% endif %} |
| 240 {% if method.is_call_with_script_arguments %} | 240 {% if method.is_call_with_script_arguments %} |
| 241 RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(script
State, info, {{method.number_of_arguments}})); | 241 RefPtrWillBeRawPtr<ScriptArguments> scriptArguments(createScriptArguments(script
State, info, {{method.number_of_arguments}})); |
| 242 {% endif %} | 242 {% endif %} |
| 243 {# Call #} | 243 {# Call #} |
| 244 {% if method.idl_type == 'void' %} | 244 {% if method.idl_type == 'void' %} |
| 245 {{cpp_value}}; | 245 {{cpp_value}}; |
| 246 {% elif method.is_constructor %} | 246 {% elif method.is_constructor %} |
| 247 {{method.cpp_type}} impl = {{cpp_value}}; | 247 {{method.cpp_type}} impl = {{cpp_value}}; |
| 248 {% elif method.is_call_with_script_state or method.is_raises_exception %} | 248 {% elif method.is_call_with_script_state or method.is_raises_exception %} |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 482 {# FIXME: remove UNLIKELY: constructors are expensive, so no difference. #} | 482 {# FIXME: remove UNLIKELY: constructors are expensive, so no difference. #} |
| 483 if (UNLIKELY(info.Length() < {{interface_length}})) { | 483 if (UNLIKELY(info.Length() < {{interface_length}})) { |
| 484 {{throw_minimum_arity_type_error(constructor, interface_length)}}; | 484 {{throw_minimum_arity_type_error(constructor, interface_length)}}; |
| 485 return; | 485 return; |
| 486 } | 486 } |
| 487 {% endif %} | 487 {% endif %} |
| 488 {% if constructor.arguments %} | 488 {% if constructor.arguments %} |
| 489 {{generate_arguments(constructor) | indent}} | 489 {{generate_arguments(constructor) | indent}} |
| 490 {% endif %} | 490 {% endif %} |
| 491 {% if is_constructor_call_with_execution_context %} | 491 {% if is_constructor_call_with_execution_context %} |
| 492 ExecutionContext* context = currentExecutionContext(isolate); | 492 ExecutionContext* executionContext = currentExecutionContext(isolate); |
| 493 {% endif %} | 493 {% endif %} |
| 494 {% if is_constructor_call_with_document %} | 494 {% if is_constructor_call_with_document %} |
| 495 Document& document = *toDocument(currentExecutionContext(isolate)); | 495 Document& document = *toDocument(currentExecutionContext(isolate)); |
| 496 {% endif %} | 496 {% endif %} |
| 497 {{constructor.cpp_type}} impl = {{cpp_class}}::create({{constructor.argument
_list | join(', ')}}); | 497 {{constructor.cpp_type}} impl = {{constructor.cpp_value}}; |
| 498 {% if is_constructor_raises_exception %} | 498 {% if is_constructor_raises_exception %} |
| 499 if (exceptionState.throwIfNeeded()) | 499 if (exceptionState.throwIfNeeded()) |
| 500 return; | 500 return; |
| 501 {% endif %} | 501 {% endif %} |
| 502 | 502 |
| 503 {{generate_constructor_wrapper(constructor) | indent}} | 503 {{generate_constructor_wrapper(constructor) | indent}} |
| 504 } | 504 } |
| 505 {% endmacro %} | 505 {% endmacro %} |
| 506 | 506 |
| 507 | 507 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 528 if (!info.IsConstructCall()) { | 528 if (!info.IsConstructCall()) { |
| 529 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("{{co
nstructor.name}}"), isolate); | 529 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("{{co
nstructor.name}}"), isolate); |
| 530 return; | 530 return; |
| 531 } | 531 } |
| 532 | 532 |
| 533 if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject
) { | 533 if (ConstructorMode::current(isolate) == ConstructorMode::WrapExistingObject
) { |
| 534 v8SetReturnValue(info, info.Holder()); | 534 v8SetReturnValue(info, info.Holder()); |
| 535 return; | 535 return; |
| 536 } | 536 } |
| 537 | 537 |
| 538 Document* document = currentDOMWindow(isolate)->document(); | 538 Document* documentPtr = currentDOMWindow(isolate)->document(); |
| 539 ASSERT(document); | 539 ASSERT(documentPtr); |
| 540 Document& document = *documentPtr; |
| 540 | 541 |
| 541 // Make sure the document is added to the DOM Node map. Otherwise, the {{cpp
_class}} instance | 542 // Make sure the document is added to the DOM Node map. Otherwise, the {{cpp
_class}} instance |
| 542 // may end up being the only node in the map and get garbage-collected prema
turely. | 543 // may end up being the only node in the map and get garbage-collected prema
turely. |
| 543 toV8(document, info.Holder(), isolate); | 544 toV8(documentPtr, info.Holder(), isolate); |
| 544 | 545 |
| 545 {% if constructor.has_exception_state %} | 546 {% if constructor.has_exception_state %} |
| 546 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf
ace_name}}", info.Holder(), isolate); | 547 ExceptionState exceptionState(ExceptionState::ConstructionContext, "{{interf
ace_name}}", info.Holder(), isolate); |
| 547 {% endif %} | 548 {% endif %} |
| 548 {% if constructor.number_of_required_arguments %} | 549 {% if constructor.number_of_required_arguments %} |
| 549 if (UNLIKELY(info.Length() < {{constructor.number_of_required_arguments}}))
{ | 550 if (UNLIKELY(info.Length() < {{constructor.number_of_required_arguments}}))
{ |
| 550 {{throw_minimum_arity_type_error(constructor, constructor.number_of_requ
ired_arguments)}}; | 551 {{throw_minimum_arity_type_error(constructor, constructor.number_of_requ
ired_arguments)}}; |
| 551 return; | 552 return; |
| 552 } | 553 } |
| 553 {% endif %} | 554 {% endif %} |
| 554 {% if constructor.arguments %} | 555 {% if constructor.arguments %} |
| 555 {{generate_arguments(constructor) | indent}} | 556 {{generate_arguments(constructor) | indent}} |
| 556 {% endif %} | 557 {% endif %} |
| 557 {{constructor.cpp_type}} impl = {{cpp_class}}::createForJSConstructor({{cons
tructor.argument_list | join(', ')}}); | 558 {{constructor.cpp_type}} impl = {{constructor.cpp_value}}; |
| 558 {% if is_constructor_raises_exception %} | 559 {% if is_constructor_raises_exception %} |
| 559 if (exceptionState.throwIfNeeded()) | 560 if (exceptionState.throwIfNeeded()) |
| 560 return; | 561 return; |
| 561 {% endif %} | 562 {% endif %} |
| 562 | 563 |
| 563 {{generate_constructor_wrapper(constructor) | indent}} | 564 {{generate_constructor_wrapper(constructor) | indent}} |
| 564 } | 565 } |
| 565 {% endmacro %} | 566 {% endmacro %} |
| OLD | NEW |