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

Unified Diff: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl

Issue 2758893002: Slim V8DOMConfiguration structs for attributes and accessors. (Closed)
Patch Set: Created 3 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
Index: third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
index db7d317064bcfc1a874ee3e3ed3d7b9928ff6448..21c784a30768a62284dcb59b8fca91e65532efba 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
@@ -339,9 +339,9 @@ void {{v8_class_or_partial}}::crossOriginIndexedGetter(uint32_t index, const v8:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
-const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
+static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
{% for data_attribute in data_attributes %}
- {{attribute_configuration(data_attribute)}},
+ {{attribute_configuration(data_attribute) | indent(4)}},
{% endfor %}
};
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
@@ -360,9 +360,9 @@ const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
-const V8DOMConfiguration::AttributeConfiguration {{v8_class}}LazyDataAttributes[] = {
+static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}LazyDataAttributes[] = {
{% for data_attribute in lazy_data_attributes %}
- {{attribute_configuration(data_attribute)}},
+ {{attribute_configuration(data_attribute) | indent(4)}},
{% endfor %}
};
#if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
@@ -375,9 +375,9 @@ const V8DOMConfiguration::AttributeConfiguration {{v8_class}}LazyDataAttributes[
{% block install_accessors %}
{% from 'attributes.cpp.tmpl' import attribute_configuration with context %}
{% if accessors %}
-const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
+static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
{% for accessor in accessors %}
- {{attribute_configuration(accessor)}},
+ {{attribute_configuration(accessor) | indent(4)}},
{% endfor %}
};
@@ -387,7 +387,7 @@ const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
{% block install_methods %}
{% from 'methods.cpp.tmpl' import method_configuration with context %}
{% if methods | has_method_configuration(is_partial) %}
-const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
+static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
{% for method in methods | has_method_configuration(is_partial) %}
{{method_configuration(method) | indent(4)}},
{% endfor %}
@@ -485,11 +485,17 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{% filter runtime_enabled(feature_name) %}
{% for attribute in attribute_list | unique_by('name') | sort %}
{% if attribute.is_data_type_property %}
- const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, prototypeTemplate, attribute{{attribute.name}}Configuration);
+ static const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration[] = {
+ {{attribute_configuration(attribute) | indent(2)}}
+ };
+ for (const auto& attributeConfig : attribute{{attribute.name}}Configuration)
+ V8DOMConfiguration::installAttribute(isolate, world, instanceTemplate, prototypeTemplate, attributeConfig);
{% else %}
- const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessor{{attribute.name}}Configuration);
+ static const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration[] = {
+ {{attribute_configuration(attribute) | indent(2)}}
+ };
+ for (const auto& accessorConfig : accessor{{attribute.name}}Configuration)
+ V8DOMConfiguration::installAccessor(isolate, world, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, accessorConfig);
{% endif %}
{% endfor %}
{% endfilter %}
@@ -524,7 +530,7 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{% filter exposed(iterator_method.exposed_test) %}
{% filter runtime_enabled(iterator_method.runtime_enabled_feature_name) %}
// Iterator (@@iterator)
- const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, {{v8_class_or_partial}}::iteratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess };
+ static const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, {{v8_class_or_partial}}::iteratorMethodCallback, 0, v8::DontEnum, V8DOMConfiguration::OnPrototype, V8DOMConfiguration::CheckHolder, V8DOMConfiguration::DoNotCheckAccess };
V8DOMConfiguration::installMethod(isolate, world, prototypeTemplate, signature, symbolKeyedIteratorConfiguration);
{% endfilter %}
{% endfilter %}
@@ -563,7 +569,7 @@ static void install{{v8_class}}Template(v8::Isolate* isolate, const DOMWrapperWo
{# TODO(dcheng): Currently, bindings must create a function object for each
realm as a hack to support the incumbent realm. Remove this when Blink
properly supports the incumbent realm. #}
- {{install_origin_safe_method(method, '', 'instanceTemplate', 'prototypeTemplate') | indent(2)}}
+ {{install_origin_safe_method(method, 'instanceTemplate', 'prototypeTemplate') | indent(2)}}
{% else %}
{{install_custom_signature(method, 'instanceTemplate', 'prototypeTemplate', 'interfaceTemplate', 'signature') | indent(2)}}
{% endif %}
@@ -599,11 +605,17 @@ void {{v8_class_or_partial}}::installRuntimeEnabledFeatures(v8::Isolate* isolate
{% filter runtime_enabled(feature_name) %}
{% for attribute in attrs | unique_by('name') | sort %}
{% if attribute.is_data_type_property %}
- const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attribute{{attribute.name}}Configuration);
+ static const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration[] = {
+ {{attribute_configuration(attribute) | indent(2)}}
+ };
+ for (const auto& attributeConfig : attribute{{attribute.name}}Configuration)
+ V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attributeConfig);
{% else %}
- const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, interface, signature, accessor{{attribute.name}}Configuration);
+ static const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration[] = {
+ {{attribute_configuration(attribute) | indent(2)}}
+ };
+ for (const auto& accessorConfig : accessor{{attribute.name}}Configuration)
+ V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, interface, signature, accessorConfig);
{% endif %}
{% endfor %}
{% endfilter %}
@@ -655,11 +667,17 @@ void {{v8_class_or_partial}}::install{{feature.name}}(v8::Isolate* isolate, cons
{# Origin-Trial-enabled attributes #}
{% for attribute in feature.attributes %}
{% if attribute.is_data_type_property %}
- const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attribute{{attribute.name}}Configuration);
+ static const V8DOMConfiguration::AttributeConfiguration attribute{{attribute.name}}Configuration[] = {
+ {{attribute_configuration(attribute) | indent(2)}}
+ };
+ for (const auto& attributeConfig : attribute{{attribute.name}}Configuration)
+ V8DOMConfiguration::installAttribute(isolate, world, instance, prototype, attributeConfig);
{% else %}
- const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration = {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, interface, signature, accessor{{attribute.name}}Configuration);
+ static const V8DOMConfiguration::AccessorConfiguration accessor{{attribute.name}}Configuration[] = {
+ {{attribute_configuration(attribute) | indent(2)}}
+ };
+ for (const auto& accessorConfig : accessor{{attribute.name}}Configuration)
+ V8DOMConfiguration::installAccessor(isolate, world, instance, prototype, interface, signature, accessorConfig);
{% endif %}
{% endfor %}
{# Origin-Trial-enabled constants #}
@@ -671,7 +689,7 @@ void {{v8_class_or_partial}}::install{{feature.name}}(v8::Isolate* isolate, cons
{# Origin-Trial-enabled methods (no overloads) #}
{% for method in feature.methods %}
{% set method_name = method.name.title().replace('_', '') %}
- const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configuration[] = {
+ static const V8DOMConfiguration::MethodConfiguration method{{method_name}}Configuration[] = {
{{method_configuration(method) | indent(2)}}
};
for (const auto& methodConfig : method{{method_name}}Configuration)

Powered by Google App Engine
This is Rietveld 408576698