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

Unified Diff: Source/bindings/templates/interface.cpp

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/templates/interface.cpp
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
index 8e9b8ac9a13a00b436cfd92f3dacf20a09b670da..7b3eefe540810e044e34f489dc6dc6c9bb89794f 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -427,8 +427,8 @@ static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::String> na
{##############################################################################}
-{% from 'methods.cpp' import generate_constructor with context %}
{% block named_constructor %}
+{% from 'methods.cpp' import generate_constructor with context %}
{% if named_constructor %}
{% set to_active_dom_object = '%s::toActiveDOMObject' % v8_class
if is_active_dom_object else '0' %}
@@ -601,8 +601,8 @@ void {{v8_class}}::visitDOMWrapper(ScriptWrappableBase* internalPointer, const v
{##############################################################################}
-{% from 'attributes.cpp' import attribute_configuration with context %}
{% block shadow_attributes %}
+{% from 'attributes.cpp' import attribute_configuration with context %}
{% if interface_name == 'Window' %}
static const V8DOMConfiguration::AttributeConfiguration shadowAttributes[] = {
{% for attribute in attributes if attribute.is_unforgeable and attribute.should_be_exposed_to_script %}
@@ -729,7 +729,14 @@ V8DOMConfiguration::installAttribute({{method.function_template}}, v8::Handle<v8
{% block get_dom_template %}
v8::Handle<v8::FunctionTemplate> {{v8_class}}::domTemplate(v8::Isolate* isolate)
{
- return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), install{{v8_class}}Template);
+ {% if has_partial_interface %}
+ {% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8_class) %}
+ ASSERT({{installTemplateFunction}} != {{actual_v8_class}}::install{{v8_class}}Template);
+ {% else %}
+ {% set installTemplateFunction = 'install%sTemplate' % v8_class %}
+ {% endif %}
+{% set installTemplateFunction = '%s::install%sTemplateFunction' % (v8_class, v8_class) if has_partial_interface else 'install%sTemplate' % v8_class %}
+ return V8DOMConfiguration::domClassTemplate(isolate, const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), {{installTemplateFunction}});
}
{% endblock %}
@@ -902,3 +909,24 @@ v8::Handle<v8::Value> toV8NoInline({{cpp_class}}* impl, v8::Handle<v8::Object> c
}
{% endblock %}
+
+{##############################################################################}
+{% block partial_interface %}
+{% if has_partial_interface %}
+InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (InstallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template;
+
+void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplateFunction, InstallConditionallyEnabledMethodsFunction installConditionallyEnabledMethodsFunction)
+{
+ {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
+ if (installConditionallyEnabledMethodsFunction)
+ {{v8_class}}::wrapperTypeInfo.installConditionallyEnabledMethodsFunction = installConditionallyEnabledMethodsFunction;
+}
+
+{% for method in methods if method.overloads and method.overloads.has_partial_overloads %}
+void {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInterface(void (*method)(const v8::FunctionCallbackInfo<v8::Value>&))
+{
+ {{actual_cpp_class}}V8Internal::{{method.name}}MethodForPartialInterface = method;
+}
+{% endfor %}
+{% endif %}
+{% endblock %}

Powered by Google App Engine
This is Rietveld 408576698