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 471 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* scriptContext = currentExecutionContext(isolate); |
Jens Widell
2014/06/17 10:40:20
Renamed to make [CallWith] handling more uniform;
haraken
2014/06/17 11:28:05
scriptContext sounds unnatural. Shall we rename it
haraken
2014/06/17 12:38:53
Let's use |executionContext| consistently.
Jens Widell
2014/06/17 12:53:16
Done.
| |
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(); |
Jens Widell
2014/06/17 10:40:20
Since this code is here, unconditionally, CallWith
Jens Widell
2014/06/17 12:53:16
This code uses 'currentDOMWindow(isolate)->documen
haraken
2014/06/17 12:57:39
The issue I want to address is just that we have b
| |
539 ASSERT(document); | 539 ASSERT(documentPtr); |
540 Document& document = *documentPtr; | |
Jens Widell
2014/06/17 10:40:20
Introduced to make [CallWith] handling more unifor
haraken
2014/06/17 11:28:05
Given that we're planning to remove CallWith=Docum
Jens Widell
2014/06/17 12:29:41
Yeah, maybe. Would you prefer I upload a patch tha
haraken
2014/06/17 12:38:53
Yes. A follow-up CL is fine :)
Jens Widell
2014/06/17 13:31:02
Hmm. Replacing ConstructorCallWith=Document with E
| |
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 |