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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}}
}; | 557 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}}
}; |
558 {% else %} | 558 {% else %} |
559 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} | 559 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} |
560 v8::Handle<v8::Value> *argv = 0; | 560 v8::Handle<v8::Value> *argv = 0; |
561 {% endif %} | 561 {% endif %} |
562 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 562 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
563 v8::TryCatch block; | 563 v8::TryCatch block; |
564 {% if method.idl_type == 'void' %} | 564 {% if method.idl_type == 'void' %} |
565 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na
me}}", holder, {{method.arguments | length}}, argv); | 565 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na
me}}", holder, {{method.arguments | length}}, argv); |
566 if (block.HasCaught()) { | 566 if (block.HasCaught()) { |
567 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { | 567 if (!PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->i
solate(), exceptionState, block)) { |
568 // FIXME: We should support more exceptions. | 568 // FIXME: We should support more exceptions. |
569 RELEASE_ASSERT_NOT_REACHED(); | 569 RELEASE_ASSERT_NOT_REACHED(); |
570 } | 570 } |
571 block.ReThrow(); | 571 block.ReThrow(); |
572 return false; | 572 return false; |
573 } | 573 } |
574 {% else %} | 574 {% else %} |
575 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar
gv); | 575 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar
gv); |
576 if (block.HasCaught()) { | 576 if (block.HasCaught()) { |
577 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { | 577 if (!PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->i
solate(), exceptionState, block)) { |
578 // FIXME: We should support more exceptions. | 578 // FIXME: We should support more exceptions. |
579 RELEASE_ASSERT_NOT_REACHED(); | 579 RELEASE_ASSERT_NOT_REACHED(); |
580 } | 580 } |
581 block.ReThrow(); | 581 block.ReThrow(); |
582 return false; | 582 return false; |
583 } | 583 } |
584 {{method.private_script_v8_value_to_local_cpp_value}}; | 584 {{method.private_script_v8_value_to_local_cpp_value}}; |
585 RELEASE_ASSERT(!exceptionState.hadException()); | 585 RELEASE_ASSERT(!exceptionState.hadException()); |
586 *result = cppValue; | 586 *result = cppValue; |
587 {% endif %} | 587 {% endif %} |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate
()); | 632 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate
()); |
633 {% else %} | 633 {% else %} |
634 {% set constructor_class = v8_class + ('Constructor' | 634 {% set constructor_class = v8_class + ('Constructor' |
635 if constructor.is_named_constructor else | 635 if constructor.is_named_constructor else |
636 '') %} | 636 '') %} |
637 v8::Handle<v8::Object> wrapper = info.Holder(); | 637 v8::Handle<v8::Object> wrapper = info.Holder(); |
638 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat
ion}}); | 638 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat
ion}}); |
639 {% endif %} | 639 {% endif %} |
640 v8SetReturnValue(info, wrapper); | 640 v8SetReturnValue(info, wrapper); |
641 {% endmacro %} | 641 {% endmacro %} |
OLD | NEW |