Index: Source/bindings/templates/partial_interface.cpp |
diff --git a/Source/bindings/templates/partial_interface.cpp b/Source/bindings/templates/partial_interface.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5a7530e5be01a78023d51651f378800e6222a734 |
--- /dev/null |
+++ b/Source/bindings/templates/partial_interface.cpp |
@@ -0,0 +1,216 @@ |
+{% extends 'interface_base.cpp' %} |
+ |
+{##############################################################################} |
haraken
2014/10/09 04:24:01
Nit: I'd drop {######} just to list up outlined bl
tasak
2014/10/10 07:52:24
Done.
|
+{% block indexed_property_getter %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block indexed_property_getter_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block indexed_property_setter %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block indexed_property_setter_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block indexed_property_deleter %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block indexed_property_deleter_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% from 'methods.cpp' import union_type_method_call_and_set_return_value %} |
haraken
2014/10/09 04:24:01
Is this needed?
tasak
2014/10/10 07:52:23
Done.
|
+{% block named_property_getter %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_getter_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_setter %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_setter_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_query %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_query_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_deleter %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_deleter_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_enumerator %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block named_property_enumerator_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block origin_safe_method_setter %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% from 'methods.cpp' import generate_constructor with context %} |
+{% block named_constructor %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block overloaded_constructor %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block event_constructor %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block visit_dom_wrapper %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block shadow_attributes %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block initialize_event %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block constructor_callback %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block configure_shadow_object_template %} |
+{% endblock %} |
+ |
+{######################################} |
+ |
+{##############################################################################} |
+{% block get_dom_template %} |
+{% endblock %} |
+{% block has_instance %} |
+{% endblock %} |
+{% block to_native_with_type_check %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block install_conditional_attributes %} |
+{% if has_conditional_attributes %} |
+void {{v8_class}}Partial::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceTemplate, v8::Isolate* isolate) |
+{ |
+ {# install per-context enabled properties defined in master interface. #} |
haraken
2014/10/09 04:24:01
master => original
tasak
2014/10/10 07:52:23
Done.
|
+ {{v8_class}}::installConditionallyEnabledProperties(instanceTemplate, isolate); |
+ |
+ {# install per-context enabled properties defined in partial interface. #} |
+ v8::Local<v8::Object> prototypeTemplate = v8::Local<v8::Object>::Cast(instanceTemplate->GetPrototype()); |
+ {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} |
+ if ({{attribute.per_context_enabled_function}}(impl->document())) { |
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
+ {{attribute_configuration(attribute)}}; |
+ V8DOMConfiguration::installAttribute(instanceTemplate, prototypeTemplate, attributeConfiguration, isolate); |
+ } |
+ {% endfor %} |
+} |
+{% else %} |
+void {{v8_class}}Partial::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceTemplate, v8::Isolate* isolate) |
+{ |
+ {# invoke installConditionallyEnabledProperties defined in master #} |
haraken
2014/10/09 04:24:01
master => original interface
tasak
2014/10/10 07:52:23
Done.
|
+ {{v8_class}}::installConditionallyEnabledProperties(instanceTemplate, isolate); |
+} |
+{% endif %} |
+{% endblock %} |
+ |
+ |
+{##############################################################################} |
+{% block install_conditional_methods %} |
+{% if conditionally_enabled_methods %}; |
+void {{v8_class}}Partial::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeTemplate, v8::Isolate* isolate) |
+{ |
+ {# Define per-context enabled operations defined in master interfaces #} |
haraken
2014/10/09 04:24:01
master => original
tasak
2014/10/10 07:52:23
Done.
|
+ {{v8_class}}::installConditionallyEnabledMethods(prototypeTemplate, isolate); |
+ |
+ {# Define per-context enabled operations #} |
+ v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate)); |
+ ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext()); |
haraken
2014/10/09 04:24:01
Where is prototypeObject defined?
tasak
2014/10/10 07:52:23
This is a bug when I copied code from interface.cp
|
+ ASSERT(context); |
+ |
+ {% for method in conditionally_enabled_methods %} |
+ {% filter per_context_enabled(method.per_context_enabled_function) %} |
+ {% filter exposed(method.exposed_test) %} |
haraken
2014/10/09 04:24:01
Shall we use 'for ... if ...' instead of filters,
tasak
2014/10/10 07:52:23
Looking at the newest code, installConditionallyEn
|
+ prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::FunctionTemplate::New(isolate, {{cpp_class}}V8PartialInternal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction()); |
+ {% endfilter %} |
+ {% endfilter %} |
+ {% endfor %} |
+} |
+{% else %} |
+void {{v8_class}}Partial::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeTemplate, v8::Isolate* isolate) |
+{ |
+ {# invoke installConditionallyEnabledMethods defined in master #} |
haraken
2014/10/09 04:24:01
master => original interface
tasak
2014/10/10 07:52:23
Done.
|
+ {{v8_class}}::installConditionallyEnabledMethods(prototypeTemplate, isolate); |
+} |
+{% endif %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block to_active_dom_object %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block to_event_target %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block get_shadow_object_template %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block wrap %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block create_wrapper %} |
haraken
2014/10/09 04:24:01
I don't fully understand why we need createWrapper
tasak
2014/10/10 07:52:23
Yeah, we don't need createWrapper for partial inte
|
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block deref_object_and_to_v8_no_inline %} |
+{% endblock %} |
+ |
+{##############################################################################} |
+{% block partial_interface %} |
+void {{v8_class}}Partial::initialize() |
+{ |
+ // Should be invoked from initModules. |
+ {{v8_class}}::updateWrapperTypeInfo( |
+ &{{v8_class}}Partial::install{{v8_class}}Template, |
+ &{{v8_class}}Partial::installConditionallyEnabledMethods); |
+ {% for method in methods %} |
+ {% if method.overloads and method.overloads.partial_overloads %} |
+ {% if not method.overload_index or method.overloads %} |
haraken
2014/10/09 04:24:01
I don't understand this condition. This if branch
tasak
2014/10/10 07:52:23
This should be "method.overloads and method.overlo
|
+ {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInterface(&{{cpp_class}}PartialV8Internal::{{method.name}}Method); |
+ {% endif %} |
+ {% endif %} |
+ {% endfor %} |
+} |
+ |
+{% endblock %} |
+ |
+ |