| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 {% for argument in method.arguments %} | 533 {% for argument in method.arguments %} |
| 534 v8::Handle<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_va
lue_to_v8_value}}; | 534 v8::Handle<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_va
lue_to_v8_value}}; |
| 535 {% endfor %} | 535 {% endfor %} |
| 536 {% if method.arguments %} | 536 {% if method.arguments %} |
| 537 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}}
}; | 537 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}}
}; |
| 538 {% else %} | 538 {% else %} |
| 539 {# Empty array initializers are illegal, and don\t compile in MSVC. #} | 539 {# Empty array initializers are illegal, and don\t compile in MSVC. #} |
| 540 v8::Handle<v8::Value> *argv = 0; | 540 v8::Handle<v8::Value> *argv = 0; |
| 541 {% endif %} | 541 {% endif %} |
| 542 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 542 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
| 543 v8::TryCatch block; | 543 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, scriptStateInUserScript, "{{cpp_class}}", "{{method.name}}", holder, {{method
.arguments | length}}, argv); |
| 544 {% if method.idl_type == 'void' %} | 544 if (v8Value.IsEmpty()) |
| 545 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na
me}}", holder, {{method.arguments | length}}, argv); | |
| 546 if (block.HasCaught()) { | |
| 547 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat
e(), block, scriptStateInUserScript, ExceptionState::ExecutionContext, "{{method
.name}}", "{{cpp_class}}"); | |
| 548 block.ReThrow(); | |
| 549 return false; | 545 return false; |
| 550 } | 546 {% if method.idl_type != 'void' %} |
| 551 {% else %} | |
| 552 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar
gv); | |
| 553 if (block.HasCaught()) { | |
| 554 PrivateScriptRunner::rethrowExceptionInPrivateScript(scriptState->isolat
e(), block, scriptStateInUserScript, ExceptionState::ExecutionContext, "{{method
.name}}", "{{cpp_class}}"); | |
| 555 block.ReThrow(); | |
| 556 return false; | |
| 557 } | |
| 558 {{method.private_script_v8_value_to_local_cpp_value}}; | 547 {{method.private_script_v8_value_to_local_cpp_value}}; |
| 559 RELEASE_ASSERT(!exceptionState.hadException()); | |
| 560 *result = cppValue; | 548 *result = cppValue; |
| 561 {% endif %} | 549 {% endif %} |
| 550 RELEASE_ASSERT(!exceptionState.hadException()); |
| 562 return true; | 551 return true; |
| 563 } | 552 } |
| 564 {% endmacro %} | 553 {% endmacro %} |
| 565 | 554 |
| 566 | 555 |
| 567 {##############################################################################} | 556 {##############################################################################} |
| 568 {% macro generate_constructor(constructor) %} | 557 {% macro generate_constructor(constructor) %} |
| 569 {% set name = '%sConstructorCallback' % v8_class | 558 {% set name = '%sConstructorCallback' % v8_class |
| 570 if constructor.is_named_constructor else | 559 if constructor.is_named_constructor else |
| 571 'constructor%s' % (constructor.overload_index or '') %} | 560 'constructor%s' % (constructor.overload_index or '') %} |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 if method.is_per_world_bindings else '0' %} | 627 if method.is_per_world_bindings else '0' %} |
| 639 {% set property_attribute = | 628 {% set property_attribute = |
| 640 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) | 629 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut
es) |
| 641 if method.property_attributes else 'v8::None' %} | 630 if method.property_attributes else 'v8::None' %} |
| 642 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} | 631 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat
eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo
sedToAllScripts' %} |
| 643 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { | 632 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig
uration = { |
| 644 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, | 633 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}},
{{method.length}}, {{only_exposed_to_private_script}}, |
| 645 }; | 634 }; |
| 646 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); | 635 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu
re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); |
| 647 {%- endmacro %} | 636 {%- endmacro %} |
| OLD | NEW |