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

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

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Added --target-component instead of --genearte-partial Created 6 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/attributes.cpp
diff --git a/Source/bindings/templates/attributes.cpp b/Source/bindings/templates/attributes.cpp
index 0c2875bc49cbd8be2c352e946d9df93409183d10..47a2cc80630b80a207d0eb37b98f87c1c754d913 100644
--- a/Source/bindings/templates/attributes.cpp
+++ b/Source/bindings/templates/attributes.cpp
@@ -165,7 +165,7 @@ v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info
{% if attribute.has_custom_getter %}
{{v8_class}}::{{attribute.name}}AttributeGetterCustom(info);
{% else %}
- {{cpp_class}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffix}}(info);
+ {{actual_cpp_class}}V8Internal::{{attribute.name}}AttributeGetter{{world_suffix}}(info);
{% endif %}
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
@@ -185,7 +185,7 @@ static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca
{% if attribute.measure_as %}
UseCounter::count(callingExecutionContext(info.GetIsolate()), UseCounter::{{attribute.measure_as}});
{% endif %}
- {{cpp_class}}V8Internal::{{cpp_class}}ConstructorGetter{{world_suffix}}(property, info);
+ {{actual_cpp_class}}V8Internal::{{cpp_class}}ConstructorGetter{{world_suffix}}(property, info);
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
{% endfilter %}
@@ -322,7 +322,7 @@ v8::Local<v8::String>, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackI
{% if attribute.has_custom_setter %}
{{v8_class}}::{{attribute.name}}AttributeSetterCustom(v8Value, info);
{% else %}
- {{cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v8Value, info);
+ {{actual_cpp_class}}V8Internal::{{attribute.name}}AttributeSetter{{world_suffix}}(v8Value, info);
{% endif %}
TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
}
@@ -389,20 +389,20 @@ bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
{% macro attribute_configuration(attribute) %}
{% set getter_callback =
'%sV8Internal::%sAttributeGetterCallback' %
- (cpp_class, attribute.name)
+ (actual_cpp_class, attribute.name)
if not attribute.constructor_type else
('%sV8Internal::%sConstructorGetterCallback' %
- (cpp_class, attribute.name)
+ (actual_cpp_class, attribute.name)
if attribute.needs_constructor_getter_callback else
- '{0}V8Internal::{0}ConstructorGetter'.format(cpp_class)) %}
+ '%sV8Internal::%sConstructorGetter' % (actual_cpp_class, cpp_class)) %}
{% set getter_callback_for_main_world =
'%sV8Internal::%sAttributeGetterCallbackForMainWorld' %
- (cpp_class, attribute.name)
+ (actual_cpp_class, attribute.name)
if attribute.is_per_world_bindings else '0' %}
{% set setter_callback = attribute.setter_callback %}
{% set setter_callback_for_main_world =
'%sV8Internal::%sAttributeSetterCallbackForMainWorld' %
- (cpp_class, attribute.name)
+ (actual_cpp_class, attribute.name)
if attribute.is_per_world_bindings and
(not attribute.is_read_only or attribute.put_forwards) else '0' %}
{% set wrapper_type_info =
@@ -434,3 +434,28 @@ bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
{% endif %}
{{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
{%- endmacro %}
+
+{##############################################################################}
+{% macro install_conditionally_enabled_properties() %}
+void {{actual_v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
+{
+ {% if is_partial %}
+ {# install per-context enabled properties defined in original interface. #}
+ {{v8_class}}::installConditionallyEnabledProperties(instanceObject, isolate);
+ {% endif %}
+ {% if has_conditional_attributes %}
+ v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype());
+ ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
+
+ {% for attribute in attributes if attribute.per_context_enabled_function or attribute.exposed_test %}
+ {% filter per_context_enabled(attribute.per_context_enabled_function) %}
+ {% filter exposed(attribute.exposed_test) %}
+ static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
+ {{attribute_configuration(attribute)}};
+ V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate);
+ {% endfilter %}
+ {% endfilter %}
+ {% endfor %}
+ {% endif %}
+}
+{%- endmacro %}

Powered by Google App Engine
This is Rietveld 408576698