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

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

Issue 1226203012: Revert of bindings: Makes almost all attributes accessor-type properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 5 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.h ('k') | Source/bindings/tests/results/core/V8SVGTestInterface.cpp » ('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 59133e5fe2a2e4fd79f39077246d6b048a79ad15..f12cde3e503ae5768877a8b7f95a90ef78768e7b 100644
--- a/Source/bindings/templates/interface_base.cpp
+++ b/Source/bindings/templates/interface_base.cpp
@@ -227,14 +227,13 @@
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[] = {
- {# [Unforgeable] attributes in Window are defined as shadow_attributes, so
- excluded here. #}
{% for attribute in attributes
- if not (attribute.exposed_test or
- attribute.runtime_enabled_function) and
- attribute.is_data_type_property and
- attribute.should_be_exposed_to_script and
- not (interface_name == 'Window' and attribute.is_unforgeable) %}
+ if not (attribute.is_expose_js_accessors or
+ attribute.is_static or
+ attribute.runtime_enabled_function or
+ attribute.exposed_test or
+ (interface_name == 'Window' and attribute.is_unforgeable))
+ and attribute.should_be_exposed_to_script %}
{% filter conditional(attribute.conditional_string) %}
{{attribute_configuration(attribute)}},
{% endfilter %}
@@ -251,14 +250,12 @@
{% from 'attributes.cpp' import attribute_configuration with context %}
{% if has_accessor_configuration %}
static const V8DOMConfiguration::AccessorConfiguration {{v8_class}}Accessors[] = {
- {# [Unforgeable] attributes in Window are defined as shadow_attributes, so
- excluded here. #}
{% for attribute in attributes
- if not (attribute.exposed_test or
- attribute.runtime_enabled_function) and
- not attribute.is_data_type_property and
- attribute.should_be_exposed_to_script and
- not (interface_name == 'Window' and attribute.is_unforgeable) %}
+ if (attribute.is_expose_js_accessors and
+ not (attribute.is_static or
+ attribute.runtime_enabled_function or
+ attribute.exposed_test) and
+ attribute.should_be_exposed_to_script) %}
{% filter conditional(attribute.conditional_string) %}
{{attribute_configuration(attribute)}},
{% endfilter %}
@@ -356,14 +353,14 @@
not attribute.is_static %}
{% filter conditional(attribute.conditional_string) %}
if ({{attribute.runtime_enabled_function}}()) {
- {% if attribute.is_data_type_property %}
- static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration = \
+ {% if attribute.is_expose_js_accessors %}
+ static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration =\
+ {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessorConfiguration);
+ {% else %}
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
{{attribute_configuration(attribute)}};
V8DOMConfiguration::installAttribute(isolate, instanceTemplate, prototypeTemplate, attributeConfiguration);
- {% else %}
- static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = \
- {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAccessor(isolate, instanceTemplate, prototypeTemplate, functionTemplate, defaultSignature, accessorConfiguration);
{% endif %}
}
{% endfilter %}
@@ -467,6 +464,16 @@
{% endfilter %}{# exposed() #}
{% endfilter %}{# conditional() #}
{% endfor %}
+ {% for attribute in attributes if attribute.is_static %}
+ {% set getter_callback = '%sV8Internal::%sAttributeGetterCallback' %
+ (cpp_class, attribute.name) %}
+ {% set setter_callback = '%sV8Internal::%sAttributeSetterCallback' %
+ (cpp_class, attribute.name)
+ if attribute.has_setter else '0' %}
+ {% filter conditional(attribute.conditional_string) %}
+ functionTemplate->SetNativeDataProperty(v8AtomicString(isolate, "{{attribute.name}}"), {{getter_callback}}, {{setter_callback}}, v8::External::New(isolate, 0), static_cast<v8::PropertyAttribute>(v8::None), v8::Local<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
+ {% endfilter %}
+ {% endfor %}
{# Special interfaces #}
{% if not is_partial %}
{% if interface_name == 'Window' %}
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/tests/results/core/V8SVGTestInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698