Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: Source/bindings/templates/methods.cpp

Issue 362993004: Implement Blink-in-JS for DOM attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 {% endfor %} 507 {% endfor %}
508 {% if method.arguments %} 508 {% if method.arguments %}
509 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} }; 509 v8::Handle<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
510 {% else %} 510 {% else %}
511 {# Empty array initializers are illegal, and don\'t compile in MSVC. #} 511 {# Empty array initializers are illegal, and don\'t compile in MSVC. #}
512 v8::Handle<v8::Value> *argv = 0; 512 v8::Handle<v8::Value> *argv = 0;
513 {% endif %} 513 {% endif %}
514 // FIXME: Support exceptions thrown from Blink-in-JS. 514 // FIXME: Support exceptions thrown from Blink-in-JS.
515 v8::TryCatch block; 515 v8::TryCatch block;
516 {% if method.returned_v8_value_to_local_cpp_value %} 516 {% if method.returned_v8_value_to_local_cpp_value %}
517 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptStat e, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, ar gv); 517 v8::Handle<v8::Value> v8Value = PrivateScriptRunner::run(scriptState, "{{cpp _class}}", "{{method.name}}", holder, {{method.arguments | length}}, argv);
518 if (block.HasCaught()) 518 if (block.HasCaught())
519 return false; 519 return false;
520 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); 520 ExceptionState exceptionState(ExceptionState::ExecutionContext, "{{method.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() );
521 {{method.raw_cpp_type}} cppValue = {{method.returned_v8_value_to_local_cpp_v alue}}; 521 {{method.raw_cpp_type}} cppValue = {{method.returned_v8_value_to_local_cpp_v alue}};
522 if (block.HasCaught()) 522 if (block.HasCaught())
523 return false; 523 return false;
524 *result = cppValue; 524 *result = cppValue;
525 {% else %}{# void return type #} 525 {% else %}{# void return type #}
526 PrivateScriptRunner::runDOMMethod(scriptState, "{{cpp_class}}", "{{method.na me}}", holder, {{method.arguments | length}}, argv); 526 PrivateScriptRunner::run(scriptState, "{{cpp_class}}", "{{method.name}}", ho lder, {{method.arguments | length}}, argv);
527 if (block.HasCaught()) 527 if (block.HasCaught())
528 return false; 528 return false;
529 {% endif %} 529 {% endif %}
530 return true; 530 return true;
531 } 531 }
532 {% endmacro %} 532 {% endmacro %}
533 533
534 534
535 {##############################################################################} 535 {##############################################################################}
536 {% macro generate_constructor(constructor) %} 536 {% macro generate_constructor(constructor) %}
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate); 588 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate);
589 {% else %} 589 {% else %}
590 {% set constructor_class = v8_class + ('Constructor' 590 {% set constructor_class = v8_class + ('Constructor'
591 if constructor.is_named_constructor else 591 if constructor.is_named_constructor else
592 '') %} 592 '') %}
593 v8::Handle<v8::Object> wrapper = info.Holder(); 593 v8::Handle<v8::Object> wrapper = info.Holder();
594 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}}); 594 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}});
595 {% endif %} 595 {% endif %}
596 v8SetReturnValue(info, wrapper); 596 v8SetReturnValue(info, wrapper);
597 {% endmacro %} 597 {% endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698