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

Unified Diff: third_party/WebKit/Source/bindings/templates/methods.cpp

Issue 1372373002: bindings: Reduces the custom registration of methods. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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: third_party/WebKit/Source/bindings/templates/methods.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp b/third_party/WebKit/Source/bindings/templates/methods.cpp
index 07327ab2c894dd42cc946d0df31edf1772664de9..d91a1e9c7c18c1e35e84f6e10644625011a5b8c6 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp
@@ -652,22 +652,22 @@ v8SetReturnValue(info, wrapper);
{% macro method_configuration(method) %}
{% from 'conversions.cpp' import property_location %}
{% set method_callback =
- '%sV8Internal::%sMethodCallback' % (cpp_class_or_partial, method.name) %}
+ '%sV8Internal::%sMethodCallback' % (cpp_class_or_partial, method.name) %}
{% set method_callback_for_main_world =
- '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class_or_partial, method.name)
- if method.is_per_world_bindings else '0' %}
+ '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class_or_partial, method.name)
+ if method.is_per_world_bindings else '0' %}
+{% set property_attribute =
+ 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attributes)
+ if method.property_attributes else 'v8::None' %}
{% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivateScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::ExposedToAllScripts' %}
-{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, {{property_location(method)}}}
+{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{property_attribute}}, {{only_exposed_to_private_script}}, {{property_location(method)}}}
{%- endmacro %}
{######################################}
{% macro install_custom_signature(method, instance_template, prototype_template, interface_template, signature) %}
-{% set property_attribute =
- 'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attributes)
- if method.property_attributes else 'v8::None' %}
const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
-V8DOMConfiguration::installMethod(isolate, {{instance_template}}, {{prototype_template}}, {{interface_template}}, {{signature}}, {{property_attribute}}, {{method.name}}MethodConfiguration);
+V8DOMConfiguration::installMethod(isolate, {{instance_template}}, {{prototype_template}}, {{interface_template}}, {{signature}}, {{method.name}}MethodConfiguration);
{%- endmacro %}
{######################################}
@@ -684,9 +684,8 @@ ASSERT(context);
{% filter runtime_enabled(method.overloads.runtime_enabled_function_all
if method.overloads else
method.runtime_enabled_function) %}
-v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}});
-v8::Local<v8::Function> function = v8CallOrCrash(functionTemplate->GetFunction(isolate->GetCurrentContext()));
-v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(isolate, "{{method.name}}"), function));
+const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
+V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObject, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration);
{% endfilter %}{# runtime_enabled() #}
{% endfilter %}{# exposed() #}
{% endfor %}

Powered by Google App Engine
This is Rietveld 408576698