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

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

Issue 542113003: bindings: Introduces ScriptWrappable::associateWithWrapper in addition to wrap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 609
610 {##############################################################################} 610 {##############################################################################}
611 {% macro generate_constructor_wrapper(constructor) %} 611 {% macro generate_constructor_wrapper(constructor) %}
612 {% if has_custom_wrap %} 612 {% if has_custom_wrap %}
613 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ()); 613 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), info.GetIsolate ());
614 {% else %} 614 {% else %}
615 {% set constructor_class = v8_class + ('Constructor' 615 {% set constructor_class = v8_class + ('Constructor'
616 if constructor.is_named_constructor else 616 if constructor.is_named_constructor else
617 '') %} 617 '') %}
618 v8::Handle<v8::Object> wrapper = info.Holder(); 618 v8::Handle<v8::Object> wrapper = info.Holder();
619 {% if is_script_wrappable %}
620 impl.get()->associateWithWrapper(&{{constructor_class}}::wrapperTypeInfo, wrappe r, info.GetIsolate());
621 {% else %}
619 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate()); 622 V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl.release(), &{{constr uctor_class}}::wrapperTypeInfo, wrapper, info.GetIsolate());
620 {% endif %} 623 {% endif %}
624 {% endif %}
621 v8SetReturnValue(info, wrapper); 625 v8SetReturnValue(info, wrapper);
622 {% endmacro %} 626 {% endmacro %}
623 627
624 628
625 {##############################################################################} 629 {##############################################################################}
626 {% macro method_configuration(method) %} 630 {% macro method_configuration(method) %}
627 {% set method_callback = 631 {% set method_callback =
628 '%sV8Internal::%sMethodCallback' % (cpp_class, method.name) %} 632 '%sV8Internal::%sMethodCallback' % (cpp_class, method.name) %}
629 {% set method_callback_for_main_world = 633 {% set method_callback_for_main_world =
630 '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class, method.name) 634 '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class, method.name)
(...skipping 10 matching lines...) Expand all
641 if method.is_per_world_bindings else '0' %} 645 if method.is_per_world_bindings else '0' %}
642 {% set property_attribute = 646 {% set property_attribute =
643 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es) 647 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attribut es)
644 if method.property_attributes else 'v8::None' %} 648 if method.property_attributes else 'v8::None' %}
645 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %} 649 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivat eScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::Expo sedToAllScripts' %}
646 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = { 650 static const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfig uration = {
647 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, 651 "{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}},
648 }; 652 };
649 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate); 653 V8DOMConfiguration::installMethod({{method.function_template}}, {{method.signatu re}}, {{property_attribute}}, {{method.name}}MethodConfiguration, isolate);
650 {%- endmacro %} 654 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698