Index: third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
index 6d4c1676888a1a26d77e849af2e7a6df82d4be1a..d53e3c26bcce933235406fb15865f62d4bbd31e7 100644 |
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp.tmpl |
@@ -475,12 +475,6 @@ const v8::FunctionCallbackInfo<v8::Value>& info |
(v8_class_or_partial, attribute.name) |
if attribute.has_setter else 'nullptr' %} |
{% endif %} |
-{% set getter_callback_for_main_world = |
- '%sForMainWorld' % getter_callback |
- if attribute.is_per_world_bindings else 'nullptr' %} |
-{% set setter_callback_for_main_world = |
- '%sForMainWorld' % setter_callback |
- if attribute.is_per_world_bindings and attribute.has_setter else 'nullptr' %} |
{% set wrapper_type_info = |
'const_cast<WrapperTypeInfo*>(&V8%s::wrapperTypeInfo)' % attribute.constructor_type |
if attribute.constructor_type else 'nullptr' %} |
@@ -492,19 +486,16 @@ const v8::FunctionCallbackInfo<v8::Value>& info |
'nullptr' %} |
{% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder' |
if attribute.is_lenient_this else 'V8DOMConfiguration::CheckHolder' %} |
-{% set attribute_configuration_list = [ |
- '"%s"' % attribute.name, |
- getter_callback, |
- setter_callback, |
- getter_callback_for_main_world, |
- setter_callback_for_main_world, |
- cached_accessor_callback, |
- wrapper_type_info, |
- property_attribute, |
- property_location(attribute), |
- holder_check, |
- ] %} |
-{{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} |
+{% if attribute.is_per_world_bindings %} |
+{% set getter_callback_for_main_world = '%sForMainWorld' % getter_callback %} |
+{% set setter_callback_for_main_world = |
+ '%sForMainWorld' % setter_callback |
+ if attribute.has_setter else 'nullptr' %} |
+{"{{attribute.name}}", {{getter_callback_for_main_world}}, {{setter_callback_for_main_world}}, {{cached_accessor_callback}}, {{wrapper_type_info}}, {{property_attribute}}, {{property_location(attribute)}}, {{holder_check}}, V8DOMConfiguration::MainWorld}, |
+{"{{attribute.name}}", {{getter_callback}}, {{setter_callback}}, {{cached_accessor_callback}}, {{wrapper_type_info}}, {{property_attribute}}, {{property_location(attribute)}}, {{holder_check}}, V8DOMConfiguration::NonMainWorlds} |
+{%- else %} |
+{"{{attribute.name}}", {{getter_callback}}, {{setter_callback}}, {{cached_accessor_callback}}, {{wrapper_type_info}}, {{property_attribute}}, {{property_location(attribute)}}, {{holder_check}}, V8DOMConfiguration::AllWorlds} |
+{%- endif %} |
{%- endmacro %} |
{##############################################################################} |
@@ -513,8 +504,11 @@ const v8::FunctionCallbackInfo<v8::Value>& info |
{% filter exposed(attribute.exposed_test) %} |
{% filter secure_context(attribute.secure_context_test) %} |
{% filter runtime_enabled(attribute.runtime_enabled_feature_name) %} |
-const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attribute_configuration(attribute)}}; |
-V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration); |
+static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration[] = { |
+ {{attribute_configuration(attribute)}} |
+}; |
+for (const auto& accessorConfig : accessorConfiguration) |
+ V8DOMConfiguration::installAccessor(isolate, world, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfig); |
{% endfilter %}{# runtime_enabled #} |
{% endfilter %}{# secure_context #} |
{% endfilter %}{# exposed #} |