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

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

Issue 24867002: Add static attributes to IDL compiler (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Template formatting Created 7 years, 3 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: Source/bindings/templates/interface.cpp
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
index 4a1af834f2aca3e98687b43e6ba5d1a1de988b18..b3664ee439c8bece3a311f136ad7c3418223ce66 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -6,9 +6,9 @@
{# FIXME: rename to install_attributes and put into configure_class_template #}
{% if attributes %}
static const V8DOMConfiguration::AttributeConfiguration {{v8_class_name}}Attributes[] = {
-{% for attribute in attributes %}
+ {% for attribute in attributes if attribute.is_normal %}
haraken 2013/09/26 22:48:30 Could you use something like 'not if attribute.is_
Nils Barth (inactive) 2013/09/27 00:26:14 Removing for now. In future we will need is_normal
{"{{attribute.name}}", {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
-{% endfor %}
+ {% endfor %}
};
{% endif %}
@@ -27,15 +27,19 @@ static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
{{attribute_templates}}, {{number_of_attributes}},
0, 0, isolate, currentWorldType);
UNUSED_PARAM(defaultSignature);
-{% if constants %}{# In general more checks than just constants #}
+ {% for attribute in attributes if attribute.is_static %}
+ // Attribute '{{attribute.name}}' (Extended Attributes: '{{attribute.extended_attributes | join(' ')}}')
haraken 2013/09/26 22:48:30 Let's remove this comment. This comment has been c
Nils Barth (inactive) 2013/09/27 00:26:14 Done, removed in Perl too!
+ desc->SetNativeDataProperty(v8::String::NewSymbol("{{attribute.name}}"), {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetterCallback, 0, v8::External::New(0), static_cast<v8::PropertyAttribute>(v8::None), v8::Handle<v8::AccessorSignature>(), static_cast<v8::AccessControl>(v8::DEFAULT));
+ {% endfor %}
+ {% if constants %}{# In general more checks than just constants #}
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
UNUSED_PARAM(instance);
UNUSED_PARAM(proto);
-{% endif %}
-{% if constants %}
+ {% endif %}
+ {% if constants %}
{{install_constants() | indent}}
-{% endif %}
+ {% endif %}
// Custom toString template
desc->Set(v8::String::NewSymbol("toString"), V8PerIsolateData::current()->toStringTemplate());
@@ -50,9 +54,9 @@ static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
{# FIXME: should use reflected_name instead of name #}
{# Normal (always enabled) constants #}
static const V8DOMConfiguration::ConstantConfiguration {{v8_class_name}}Constants[] = {
-{% for constant in constants if not constant.enabled_at_runtime %}
+ {% for constant in constants if not constant.enabled_at_runtime %}
{"{{constant.name}}", {{constant.value}}},
-{% endfor %}
+ {% endfor %}
};
V8DOMConfiguration::installConstants(desc, proto, {{v8_class_name}}Constants, WTF_ARRAY_LENGTH({{v8_class_name}}Constants), isolate);
{# Runtime-enabled constants #}

Powered by Google App Engine
This is Rietveld 408576698