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

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

Issue 59853010: IDL compiler: [PerContextEnabled] methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years, 1 month 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 4942cc4edfa1148dfeaed771d2adf3a79bf3247e..b68bdbe87529d6964df8122754f472688bb03dd5 100644
--- a/Source/bindings/templates/interface.cpp
+++ b/Source/bindings/templates/interface.cpp
@@ -73,7 +73,9 @@ static const V8DOMConfiguration::AttributeConfiguration {{v8_class_name}}Attribu
{# FIXME: rename to install_methods and put into configure_class_template #}
{% if methods %}
static const V8DOMConfiguration::MethodConfiguration {{v8_class_name}}Methods[] = {
- {% for method in methods if method.do_not_check_signature %}
+ {% for method in methods
+ if method.do_not_check_signature and
+ not method.per_context_enabled_function_name %}
{% filter conditional(method.conditional_string) %}
{{method_configuration(method)}},
{% endfilter %}
@@ -98,7 +100,8 @@ static v8::Handle<v8::FunctionTemplate> Configure{{v8_class_name}}Template(v8::H
{%+ if methods %}{{v8_class_name}}Methods, WTF_ARRAY_LENGTH({{v8_class_name}}Methods){% else %}0, 0{% endif %},
isolate, currentWorldType);
UNUSED_PARAM(defaultSignature);
- {% if constants or has_runtime_enabled_attributes %}
+ {% if constants or has_runtime_enabled_attributes or
+ has_non_per_context_enabled_methods %}
v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
UNUSED_PARAM(instance);
@@ -225,6 +228,27 @@ void {{v8_class_name}}::installPerContextEnabledProperties(v8::Handle<v8::Object
{##############################################################################}
+{% block install_per_context_methods %}
+{% if has_per_context_enabled_methods %}
+void {{v8_class_name}}::installPerContextEnabledPrototypeProperties(v8::Handle<v8::Object> proto, v8::Isolate* isolate)
+{
+ UNUSED_PARAM(proto);
+ {# Define per-context enabled operations #}
+ v8::Local<v8::Signature> defaultSignature = v8::Signature::New(GetTemplate(isolate, worldType(isolate)));
+ UNUSED_PARAM(defaultSignature);
+
+ ExecutionContext* context = toExecutionContext(proto->CreationContext());
+ {% for method in methods if method.per_context_enabled_function_name %}
+ if (context && context->isDocument() && {{method.per_context_enabled_function_name}}(toDocument(context)))
+ proto->Set(v8::String::NewSymbol("{{method.name}}"), v8::FunctionTemplate::New({{cpp_class_name}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}})->GetFunction());
+ {% 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)
{
« 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