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 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 if (context.IsEmpty()) | 504 if (context.IsEmpty()) |
505 return false; | 505 return false; |
506 ScriptState* scriptState = ScriptState::from(context); | 506 ScriptState* scriptState = ScriptState::from(context); |
507 if (!scriptState->executionContext()) | 507 if (!scriptState->executionContext()) |
508 return false; | 508 return false; |
509 | 509 |
510 ScriptState::Scope scope(scriptState); | 510 ScriptState::Scope scope(scriptState); |
511 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); | 511 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob
al(), scriptState->isolate()); |
512 | 512 |
513 {% for argument in method.arguments %} | 513 {% for argument in method.arguments %} |
514 v8::Handle<v8::Value> {{argument.handle}} = {{argument.cpp_value_to_v8_value
}}; | 514 v8::Handle<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_va
lue_to_v8_value}}; |
515 {% endfor %} | 515 {% endfor %} |
516 {% if method.arguments %} | 516 {% if method.arguments %} |
517 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}}
}; | 517 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}}
}; |
518 {% else %} | 518 {% else %} |
519 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} | 519 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} |
520 v8::Handle<v8::Value> *argv = 0; | 520 v8::Handle<v8::Value> *argv = 0; |
521 {% endif %} | 521 {% endif %} |
522 // FIXME: Support exceptions thrown from Blink-in-JS. | 522 // FIXME: Support exceptions thrown from Blink-in-JS. |
523 v8::TryCatch block; | 523 v8::TryCatch block; |
524 {% if method.returned_v8_value_to_local_cpp_value %} | 524 {% if method.idl_type == 'void' %} |
| 525 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na
me}}", holder, {{method.arguments | length}}, argv); |
| 526 if (block.HasCaught()) |
| 527 return false; |
| 528 {% else %} |
525 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar
gv); | 529 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat
e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar
gv); |
526 if (block.HasCaught()) | 530 if (block.HasCaught()) |
527 return false; | 531 return false; |
528 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); | 532 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na
me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate()
); |
529 {{method.raw_cpp_type}} cppValue = {{method.returned_v8_value_to_local_cpp_v
alue}}; | 533 {{method.private_script_v8_value_to_local_cpp_value}}; |
530 if (block.HasCaught()) | 534 if (block.HasCaught()) |
531 return false; | 535 return false; |
532 *result = cppValue; | 536 *result = cppValue; |
533 {% else %}{# void return type #} | |
534 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na
me}}", holder, {{method.arguments | length}}, argv); | |
535 if (block.HasCaught()) | |
536 return false; | |
537 {% endif %} | 537 {% endif %} |
538 return true; | 538 return true; |
539 } | 539 } |
540 {% endmacro %} | 540 {% endmacro %} |
541 | 541 |
542 | 542 |
543 {##############################################################################} | 543 {##############################################################################} |
544 {% macro generate_constructor(constructor) %} | 544 {% macro generate_constructor(constructor) %} |
545 {% set name = '%sConstructorCallback' % v8_class | 545 {% set name = '%sConstructorCallback' % v8_class |
546 if constructor.is_named_constructor else | 546 if constructor.is_named_constructor else |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate); | 585 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate); |
586 {% else %} | 586 {% else %} |
587 {% set constructor_class = v8_class + ('Constructor' | 587 {% set constructor_class = v8_class + ('Constructor' |
588 if constructor.is_named_constructor else | 588 if constructor.is_named_constructor else |
589 '') %} | 589 '') %} |
590 v8::Handle<v8::Object> wrapper = info.Holder(); | 590 v8::Handle<v8::Object> wrapper = info.Holder(); |
591 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}}); | 591 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr
uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}}); |
592 {% endif %} | 592 {% endif %} |
593 v8SetReturnValue(info, wrapper); | 593 v8SetReturnValue(info, wrapper); |
594 {% endmacro %} | 594 {% endmacro %} |
OLD | NEW |