Index: Source/bindings/templates/interface.cpp |
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp |
index d26cbd2ef349ac23c4c48880e921b4a3e1d3dfd5..663bcafe1db905d6d5da5c36d8938ea740165ff6 100644 |
--- a/Source/bindings/templates/interface.cpp |
+++ b/Source/bindings/templates/interface.cpp |
@@ -2,25 +2,6 @@ |
{##############################################################################} |
-{% block security_check_functions %} |
-{% if has_access_check_callbacks %} |
-bool indexedSecurityCheck(v8::Local<v8::Object> host, uint32_t index, v8::AccessType type, v8::Local<v8::Value>) |
-{ |
- {{cpp_class}}* impl = {{v8_class}}::toImpl(host); |
- return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); |
-} |
- |
-bool namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>) |
-{ |
- {{cpp_class}}* impl = {{v8_class}}::toImpl(host); |
- return BindingSecurity::shouldAllowAccessToFrame(v8::Isolate::GetCurrent(), impl->frame(), DoNotReportSecurityError); |
-} |
- |
-{% endif %} |
-{% endblock %} |
- |
- |
-{##############################################################################} |
{% block indexed_property_getter %} |
{% if indexed_property_getter and not indexed_property_getter.is_custom %} |
{% set getter = indexed_property_getter %} |
@@ -446,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' %} |
@@ -620,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 %} |
@@ -748,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 %} |
@@ -780,52 +768,6 @@ v8::Handle<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Handle<v8: |
{##############################################################################} |
-{% block install_conditional_attributes %} |
-{% if has_conditional_attributes %} |
-void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate) |
-{ |
- v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype()); |
- ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext()); |
- |
- {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %} |
- {% filter per_context_enabled(attribute.per_context_enabled_function) %} |
- {% filter exposed(attribute.exposed_test) %} |
- static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\ |
- {{attribute_configuration(attribute)}}; |
- V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate); |
- {% endfilter %} |
- {% endfilter %} |
- {% endfor %} |
-} |
- |
-{% endif %} |
-{% endblock %} |
- |
- |
-{##############################################################################} |
-{% block install_conditional_methods %} |
-{% if conditionally_enabled_methods %} |
-void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate) |
-{ |
- {# Define per-context enabled operations #} |
- v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate)); |
- ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext()); |
- ASSERT(context); |
- |
- {% for method in conditionally_enabled_methods %} |
- {% filter per_context_enabled(method.per_context_enabled_function) %} |
- {% filter exposed(method.exposed_test) %} |
- prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::FunctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction()); |
- {% endfilter %} |
- {% endfilter %} |
- {% endfor %} |
-} |
- |
-{% endif %} |
-{% endblock %} |
- |
- |
-{##############################################################################} |
{% block to_active_dom_object %} |
{% if is_active_dom_object %} |
ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Handle<v8::Object> wrapper) |
@@ -967,3 +909,26 @@ 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 %} |
bashi
2014/10/15 05:29:23
nit: you can merge "for" and "if" like above.
tasak
2014/10/15 11:24:19
Done.
|
+{% 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; |
+} |
+{% endif %} |
+{% endfor %} |
+{% endif %} |
+{% endblock %} |