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

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

Issue 26547005: IDL compiler: [PerContextEnabled] for getters (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix caps Created 7 years, 2 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 0e33578eb97328f1c765a9d6273737adc1e3d09d..361f00d576470d669f94d28d09472fd6a246f3f4 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -2,14 +2,21 @@
{##############################################################################}
+{% macro attribute_configuration(attribute) %}
+{"{{attribute.name}}", {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>({{attribute.access_control_list | join(' | ')}}), static_cast<v8::PropertyAttribute>({{attribute.property_attributes | join(' | ')}}), 0 /* on instance */}{% endmacro %}
+
+
+{##############################################################################}
{% block class_attributes %}
{# 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
- if not (attribute.runtime_enabled_function_name or attribute.is_static) %}
+ if not (attribute.runtime_enabled_function_name or
+ attribute.per_context_enabled_function_name or
+ attribute.is_static) %}
{% filter conditional(attribute.conditional_string) %}
- {"{{attribute.name}}", {{cpp_class_name}}V8Internal::{{attribute.name}}AttributeGetterCallback, 0, 0, 0, 0, static_cast<v8::AccessControl>({{attribute.access_control_list | join(' | ')}}), static_cast<v8::PropertyAttribute>({{attribute.property_attributes | join(' | ')}}), 0 /* on instance */},
+ {{attribute_configuration(attribute)}},
{% endfilter %}
{% endfor %}
};
@@ -40,7 +47,7 @@ static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
{% filter conditional(attribute.conditional_string) %}
if ({{attribute.runtime_enabled_function_name}}()) {
static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
- {"{{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 */};
+ {{attribute_configuration(attribute)}};
V8DOMConfiguration::installAttribute(instance, proto, attributeConfiguration, isolate, currentWorldType);
}
{% endfilter %}
@@ -125,6 +132,25 @@ bool {{v8_class_name}}::HasInstanceInAnyWorld(v8::Handle<v8::Value> value, v8::I
{##############################################################################}
+{% block install_per_context_attributes %}
+{% if has_per_context_enabled_attributes %}
+void {{v8_class_name}}::installPerContextProperties(v8::Handle<v8::Object> instance, {{cpp_class_name}}* impl, v8::Isolate* isolate)
haraken 2013/10/16 05:28:06 installPerContextProperties => installPerContextEn
Nils Barth (inactive) 2013/10/16 06:05:17 Done! (Results in lots of test result changes.)
+{
+ v8::Local<v8::Object> proto = v8::Local<v8::Object>::Cast(instance->GetPrototype());
+ {% for attribute in attributes if attribute.per_context_enabled_function_name %}
+ if ({{attribute.per_context_enabled_function_name}}(impl->document())) {
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
+ {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAttribute(instance, proto, attributeConfiguration, isolate);
+ }
+ {% endfor %}
+}
+
+{% endif %}
+{% endblock %}
+
+
+{##############################################################################}
{% block create_wrapper_and_deref_object %}
v8::Handle<v8::Object> {{v8_class_name}}::createWrapper(PassRefPtr<{{cpp_class_name}}> impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
{

Powered by Google App Engine
This is Rietveld 408576698