| 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 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 v8::Handle<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_va
lue_to_v8_value}}; | 554 v8::Handle<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_va
lue_to_v8_value}}; |
| 555 {% endfor %} | 555 {% endfor %} |
| 556 {% if method.arguments %} | 556 {% if method.arguments %} |
| 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 V8RethrowTryCatchScope rethrow(block); | |
| 565 {% if method.idl_type == 'void' %} | 564 {% if method.idl_type == 'void' %} |
| 566 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); |
| 567 if (block.HasCaught()) { | 566 if (block.HasCaught()) { |
| 568 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { | 567 if (!PrivateScriptRunner::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { |
| 569 // FIXME: We should support more exceptions. | 568 // FIXME: We should support more exceptions. |
| 570 RELEASE_ASSERT_NOT_REACHED(); | 569 RELEASE_ASSERT_NOT_REACHED(); |
| 571 } | 570 } |
| 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::throwDOMExceptionInPrivateScriptIfNeeded(scrip
tState->isolate(), exceptionState, block.Exception())) { |
| 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 return false; | 582 return false; |
| 582 } | 583 } |
| 583 {{method.private_script_v8_value_to_local_cpp_value}}; | 584 {{method.private_script_v8_value_to_local_cpp_value}}; |
| 584 RELEASE_ASSERT(!exceptionState.hadException()); | 585 RELEASE_ASSERT(!exceptionState.hadException()); |
| 585 *result = cppValue; | 586 *result = cppValue; |
| 586 {% endif %} | 587 {% endif %} |
| 587 return true; | 588 return true; |
| 588 } | 589 } |
| 589 {% endmacro %} | 590 {% endmacro %} |
| 590 | 591 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 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
()); |
| 632 {% else %} | 633 {% else %} |
| 633 {% set constructor_class = v8_class + ('Constructor' | 634 {% set constructor_class = v8_class + ('Constructor' |
| 634 if constructor.is_named_constructor else | 635 if constructor.is_named_constructor else |
| 635 '') %} | 636 '') %} |
| 636 v8::Handle<v8::Object> wrapper = info.Holder(); | 637 v8::Handle<v8::Object> wrapper = info.Holder(); |
| 637 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}}); |
| 638 {% endif %} | 639 {% endif %} |
| 639 v8SetReturnValue(info, wrapper); | 640 v8SetReturnValue(info, wrapper); |
| 640 {% endmacro %} | 641 {% endmacro %} |
| OLD | NEW |