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

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

Issue 1008353002: bindings: Reduces the binary size by reducing # of callback functions. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 5 years, 9 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
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/idls/core/TestInterface.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 %}
{##############################################################################}
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/tests/idls/core/TestInterface.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698