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

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

Issue 424163002: Enable the WebIDL [Exposed] annotation on an interface's members. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: missed renames Created 6 years, 4 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/interface_base.cpp » ('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 8de72fe44c9067a456041aa5190eaf4cb4b2d59a..d95ed42b593d97a7cda941c75ac131f948b33d31 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -560,7 +560,7 @@ static void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::String> na
if is_active_dom_object else '0' %}
{% set to_event_target = '%s::toEventTarget' % v8_class
if is_event_target else '0' %}
-const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_active_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installPerContextEnabledMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} };
+const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::derefObject, {{to_active_dom_object}}, {{to_event_target}}, 0, {{v8_class}}::installConditionallyEnabledMethods, 0, WrapperTypeObjectPrototype, {{gc_type}} };
{{generate_constructor(named_constructor)}}
v8::Handle<v8::FunctionTemplate> {{v8_class}}Constructor::domTemplate(v8::Isolate* isolate)
@@ -748,6 +748,7 @@ static const V8DOMConfiguration::AttributeConfiguration {{v8_class}}Attributes[]
attribute.is_static or
attribute.runtime_enabled_function or
attribute.per_context_enabled_function or
+ attribute.exposed_test or
(interface_name == 'Window' and attribute.is_unforgeable))
and attribute.should_be_exposed_to_script %}
{% filter conditional(attribute.conditional_string) %}
@@ -922,6 +923,7 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio
{% for attribute in attributes
if attribute.runtime_enabled_function and
not attribute.per_context_enabled_function and
+ not attribute.exposed_test and
not attribute.is_static %}
{% filter conditional(attribute.conditional_string) %}
if ({{attribute.runtime_enabled_function}}()) {
@@ -1155,17 +1157,21 @@ v8::Handle<v8::Object> {{v8_class}}::findInstanceInPrototypeChain(v8::Handle<v8:
{##############################################################################}
-{% block install_per_context_attributes %}
-{% if has_per_context_enabled_attributes %}
-void {{v8_class}}::installPerContextEnabledProperties(v8::Handle<v8::Object> instanceObject, {{cpp_class}}* impl, v8::Isolate* isolate)
+{% block install_conditional_attributes %}
+{% if has_conditional_attributes %}
+void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
{
v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype());
- {% for attribute in attributes if attribute.per_context_enabled_function %}
- if ({{attribute.per_context_enabled_function}}(impl->document())) {
- static const V8DOMConfiguration::AttributeConfiguration attributeConfiguration =\
- {{attribute_configuration(attribute)}};
- V8DOMConfiguration::installAttribute(instanceObject, prototypeObject, attributeConfiguration, isolate);
- }
+ 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 %}
}
@@ -1174,20 +1180,21 @@ void {{v8_class}}::installPerContextEnabledProperties(v8::Handle<v8::Object> ins
{##############################################################################}
-{% block install_per_context_methods %}
-{% if per_context_enabled_methods %}
-void {{v8_class}}::installPerContextEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate)
+{% block install_conditional_methods %}
+{% if conditionally_enabled_methods %}
+void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate)
{
{# Define per-context enabled operations #}
v8::Local<v8::Signature> defaultSignature = v8::Signature::New(isolate, domTemplate(isolate));
-
ExecutionContext* context = toExecutionContext(prototypeObject->CreationContext());
ASSERT(context);
- {% for method in per_context_enabled_methods %}
- if (context->isDocument() && {{method.per_context_enabled_function}}(toDocument(context))) {
- static const V8DOMConfiguration::MethodConfiguration methodConfiguration = {{method_configuration(method)}};
- V8DOMConfiguration::installMethod(prototypeObject, defaultSignature, v8::None, methodConfiguration, isolate);
- }
+
+ {% for method in conditionally_enabled_methods %}
+ {% filter per_context_enabled(method.per_context_enabled_function) %}
+ {% filter exposed(method.exposed_test) %}
+ prototypeObject->Set(v8AtomicString(isolate, "{{method.name}}"), v8::FunctionTemplate::New(isolate, {{cpp_class}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction());
+ {% endfilter %}
+ {% endfilter %}
{% endfor %}
}
@@ -1324,7 +1331,7 @@ v8::Handle<v8::Object> {{v8_class}}::createWrapper({{pass_cpp_type}} impl, v8::H
channelData->buffer()->setDeallocationObserver(V8ArrayBufferDeallocationObserver::instanceTemplate());
}
{% endif %}
- installPerContextEnabledProperties(wrapper, impl.get(), isolate);
+ installConditionallyEnabledProperties(wrapper, isolate);
V8DOMWrapper::associateObjectWithWrapper<{{v8_class}}>(impl, &wrapperTypeInfo, wrapper, isolate, {{wrapper_configuration}});
return wrapper;
}
« no previous file with comments | « Source/bindings/templates/interface.h ('k') | Source/bindings/templates/interface_base.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698