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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
518 v8::Handle<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_va lue_to_v8_value}}; | 518 v8::Handle<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_va lue_to_v8_value}}; |
519 {% endfor %} | 519 {% endfor %} |
520 {% if method.arguments %} | 520 {% if method.arguments %} |
521 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; | 521 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; |
522 {% else %} | 522 {% else %} |
523 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} | 523 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} |
524 v8::Handle<v8::Value> *argv = 0; | 524 v8::Handle<v8::Value> *argv = 0; |
525 {% endif %} | 525 {% endif %} |
526 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); | 526 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); |
527 v8::TryCatch block; | 527 v8::TryCatch block; |
528 #ifndef NDEBUG | |
529 block.SetVerbose(true); | |
530 #endif | |
528 V8RethrowTryCatchScope rethrow(block); | 531 V8RethrowTryCatchScope rethrow(block); |
Jens Widell
2014/08/11 09:26:15
Unrelated: Using a V8RethrowTryCatchScope here is
haraken
2014/08/11 09:41:16
Makes a lot of sense. Will fix in a separate CL sh
| |
529 {% if method.idl_type == 'void' %} | 532 {% if method.idl_type == 'void' %} |
530 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na me}}", holder, {{method.arguments | length}}, argv); | 533 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na me}}", holder, {{method.arguments | length}}, argv); |
531 if (block.HasCaught()) { | 534 if (block.HasCaught()) { |
Jens Widell
2014/08/11 09:26:15
Should we have block.SetVerbose(false) here too? O
haraken
2014/08/11 09:41:16
In my understanding, it will happen, so I limited
Jens Widell
2014/08/11 09:52:47
I got the impression (having for the first time lo
haraken
2014/08/11 11:56:41
Thanks for looking into the details!
However, I g
Jens Widell
2014/08/11 12:08:28
I would think it would, but I haven't tested it an
haraken
2014/08/11 13:26:20
Thanks, I understand what you're saying. Given tha
| |
532 PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scriptStat e->isolate(), exceptionState, block.Exception()); | 535 PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scriptStat e->isolate(), exceptionState, block.Exception()); |
Jens Widell
2014/08/11 09:26:15
Unrelated: Why aren't we checking the return value
haraken
2014/08/11 09:41:16
You're right. Will fix in a separate CL shortly.
| |
533 return false; | 536 return false; |
534 } | 537 } |
535 {% else %} | 538 {% else %} |
536 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar gv); | 539 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar gv); |
537 if (block.HasCaught()) { | 540 if (block.HasCaught()) { |
538 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip tState->isolate(), exceptionState, block.Exception())) { | 541 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip tState->isolate(), exceptionState, block.Exception())) { |
539 // FIXME: We should support exceptions other than DOM exceptions. | 542 // FIXME: We should support exceptions other than DOM exceptions. |
540 RELEASE_ASSERT_NOT_REACHED(); | 543 RELEASE_ASSERT_NOT_REACHED(); |
541 } | 544 } |
542 return false; | 545 return false; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
592 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ()); | 595 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ()); |
593 {% else %} | 596 {% else %} |
594 {% set constructor_class = v8_class + ('Constructor' | 597 {% set constructor_class = v8_class + ('Constructor' |
595 if constructor.is_named_constructor else | 598 if constructor.is_named_constructor else |
596 '') %} | 599 '') %} |
597 v8::Handle<v8::Object> wrapper = info.Holder(); | 600 v8::Handle<v8::Object> wrapper = info.Holder(); |
598 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}}); | 601 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate(), {{wrapper_configurat ion}}); |
599 {% endif %} | 602 {% endif %} |
600 v8SetReturnValue(info, wrapper); | 603 v8SetReturnValue(info, wrapper); |
601 {% endmacro %} | 604 {% endmacro %} |
OLD | NEW |