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

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

Issue 1202683002: bindings: Supports per-member [Exposed] for attributes on prototype. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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/partial_interface.cpp
diff --git a/Source/bindings/templates/partial_interface.cpp b/Source/bindings/templates/partial_interface.cpp
index 2282dd3a01534f8f4980c6ebbec88cdb7ffc2c9d..3b40e4b75e57109872cda82c4373718fdb987f66 100644
--- a/Source/bindings/templates/partial_interface.cpp
+++ b/Source/bindings/templates/partial_interface.cpp
@@ -6,12 +6,23 @@
{% from 'interface.cpp' import install_unscopeables with context %}
{% from 'methods.cpp' import install_conditionally_enabled_methods
with context %}
-void {{v8_class_or_partial}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject)
+void {{v8_class_or_partial}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
{
- {{v8_class}}::preparePrototypeObject(isolate, prototypeObject);
+ {{v8_class}}::preparePrototypeObject(isolate, prototypeObject, interfaceTemplate);
{% if unscopeables %}
{{install_unscopeables() | indent}}
{% endif %}
+{% if has_conditional_attributes_on_prototype %}
+ ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
+ v8::Local<v8::Signature> signature = v8::Signature::New(isolate, interfaceTemplate);
+
+ {% for attribute in attributes if attribute.exposed_test and attribute.on_prototype %}
+ {% filter exposed(attribute.exposed_test) %}
+ static const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAccessor(isolate, v8::Local<v8::Object>(), prototypeObject, v8::Local<v8::Function>(), signature, accessorConfiguration);
+ {% endfilter %}
+ {% endfor %}
+{% endif %}
{% if conditionally_enabled_methods %}
{{install_conditionally_enabled_methods() | indent}}
{% endif %}

Powered by Google App Engine
This is Rietveld 408576698