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

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

Issue 1202683002: bindings: Supports per-member [Exposed] for attributes on prototype. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed a review comment. 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
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/partial_interface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/interface.cpp
diff --git a/Source/bindings/templates/interface.cpp b/Source/bindings/templates/interface.cpp
index 5b1a9fde3edca9d0726e5ed8e36f9de5d6b679c4..4059005269323210e0aae28bc8300c47630e1598 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -797,24 +797,10 @@ v8::Local<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Local<v8::V
{##############################################################################}
{% block install_conditional_attributes %}
{% from 'attributes.cpp' import attribute_configuration with context %}
-{% if has_conditional_attributes %}
+{% if has_conditional_attributes_on_instance %}
void {{v8_class}}::installConditionallyEnabledProperties(v8::Local<v8::Object> instanceObject, v8::Isolate* isolate)
{
- v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype());
- ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
-
- {% for attribute in attributes if attribute.exposed_test %}
- {% filter exposed(attribute.exposed_test) %}
-#error No one is actually using per-member [Exposed] extended attribute. Not supported. Contact to blink-reviews-bindings@ if you need.
-// TODO(yukishiino): Implement the feature again if there is a client.
- {% endfilter %}
- {% endfor %}
- {% for method in methods if method.exposed_test %}
- {% filter exposed(method.exposed_test) %}
-#error No one is actually using per-member [Exposed] extended attribute. Not supported. Contact to blink-reviews-bindings@ if you need.
-// TODO(yukishiino): Implement the feature again if there is a client.
- {% endfilter %}
- {% endfor %}
+#error TODO(yukishiino): Rename this function to prepareInstanceObject (c.f. preparePrototypeObject) and implement this function if necessary. http://crbug.com/503508
}
{% endif %}
@@ -824,12 +810,15 @@ void {{v8_class}}::installConditionallyEnabledProperties(v8::Local<v8::Object> i
{##############################################################################}
{% block prepare_prototype_object %}
{% from 'methods.cpp' import install_conditionally_enabled_methods with context %}
-{% if unscopeables or conditionally_enabled_methods %}
-void {{v8_class}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject)
+{% if unscopeables or has_conditional_attributes_on_prototype or conditionally_enabled_methods %}
+void {{v8_class}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
{
{% if unscopeables %}
{{install_unscopeables() | indent}}
{% endif %}
+{% if has_conditional_attributes_on_prototype %}
+ {{install_conditionally_enabled_attributes_on_prototype() | indent}}
+{% endif %}
{% if conditionally_enabled_methods %}
{{install_conditionally_enabled_methods() | indent}}
{% endif %}
@@ -858,6 +847,20 @@ prototypeObject->CreateDataProperty(v8Context, unscopablesSymbol, unscopeables).
{##############################################################################}
+{% macro install_conditionally_enabled_attributes_on_prototype() %}
+{% from 'attributes.cpp' import attribute_configuration with context %}
+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 %}
+{% endmacro %}
+
+
+{##############################################################################}
{% block to_active_dom_object %}
{% if is_active_dom_object %}
ActiveDOMObject* {{v8_class}}::toActiveDOMObject(v8::Local<v8::Object> wrapper)
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/partial_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698