Index: Source/bindings/templates/interface_base.cpp |
diff --git a/Source/bindings/templates/interface_base.cpp b/Source/bindings/templates/interface_base.cpp |
index 941e6df3fd6eddcf0d64d6f7493fae3e8e1dd53a..b622ef728e2f2bc503806c1e4012291fa8886220 100644 |
--- a/Source/bindings/templates/interface_base.cpp |
+++ b/Source/bindings/templates/interface_base.cpp |
@@ -25,7 +25,7 @@ namespace blink { |
{% set wrapper_type_info_const = '' if has_partial_interface else 'const ' %} |
{% if not is_partial %} |
-{{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; |
+{{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditionallyEnabledProperties, "{{interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} }; |
// This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}}.h. |
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in |
@@ -69,6 +69,25 @@ static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::Name> name, v8::L |
v8::Local<v8::Object>::Cast(info.This())->ForceSet(name, v8Value); |
} |
+{% if has_constructor_attributes %} |
+static void {{cpp_class}}ConstructorAttributeSetterCallback(v8::Local<v8::Name>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) |
+{ |
+ TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMSetter"); |
+ do { |
+ v8::Local<v8::Value> data = info.Data(); |
+ ASSERT(data->IsExternal()); |
+ V8PerContextData* perContextData = V8PerContextData::from(info.Holder()->CreationContext()); |
+ if (!perContextData) |
+ break; |
+ const WrapperTypeInfo* wrapperTypeInfo = WrapperTypeInfo::unwrap(data); |
+ if (!wrapperTypeInfo) |
+ break; |
+ {{cpp_class}}ForceSetAttributeOnThis(v8String(info.GetIsolate(), wrapperTypeInfo->interfaceName), v8Value, info); |
+ } while (false); // do ... while (false) just for use of break |
+ TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); |
+} |
+ |
+{% endif %} |
{% endif %} |
{% endblock %} |
{##############################################################################} |
@@ -87,11 +106,14 @@ static void {{cpp_class}}ForceSetAttributeOnThis(v8::Local<v8::Name> name, v8::L |
{{attribute_getter_callback(attribute, world_suffix)}} |
{% endif %} |
{% if attribute.has_setter %} |
-{% if not attribute.has_custom_setter %} |
+{% if not attribute.has_custom_setter and |
+ (not attribute.constructor_type or attribute.needs_constructor_setter_callback) %} |
{{attribute_setter(attribute, world_suffix)}} |
{% endif %} |
+{% if not attribute.constructor_type or attribute.needs_constructor_setter_callback %} |
{{attribute_setter_callback(attribute, world_suffix)}} |
{% endif %} |
+{% endif %} |
{% endfor %} |
{% endfor %} |
{##############################################################################} |