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

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

Issue 2653883006: [bindings] Move callback functions from V8FooInternal namespace to V8Foo class (Closed)
Patch Set: Revert expose change Created 3 years, 11 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.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
index d212e1eb702426116c3579ceb2524453ec2c4794..43137dc9d98225944e18cfdd1fce805d56ffb8ed 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
@@ -483,7 +483,7 @@ static void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance,
{##############################################################################}
{% macro method_callback(method, world_suffix) %}
-{{exported}} void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) {
+void {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) {
{% if not method.overloads %}{# Overloaded methods are measured in overload_resolution_method() #}
{% if method.measure_as %}
UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
@@ -511,7 +511,7 @@ static void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance,
{% if method.is_custom %}
{{v8_class}}::{{method.name}}MethodCustom(info);
{% elif method.is_post_message %}
- postMessageImpl("{{interface_name}}", {{v8_class}}::toImpl(info.Holder()), info);
+ {{cpp_class_or_partial}}V8Internal::postMessageImpl("{{interface_name}}", {{v8_class}}::toImpl(info.Holder()), info);
{% else %}
{{cpp_class_or_partial}}V8Internal::{{method.name}}Method{{world_suffix}}(info);
{% endif %}
@@ -531,7 +531,7 @@ static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop
v8::Local<v8::FunctionTemplate> interfaceTemplate = data->findInterfaceTemplate(world, &{{v8_class}}::wrapperTypeInfo);
v8::Local<v8::Signature> signature = v8::Signature::New(info.GetIsolate(), interfaceTemplate);
- v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTemplate(world, &domTemplateKey, {{cpp_class}}V8Internal::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), signature, {{method.length}});
+ v8::Local<v8::FunctionTemplate> methodTemplate = data->findOrCreateOperationTemplate(world, &domTemplateKey, {{v8_class_or_partial}}::{{method.name}}MethodCallback{{world_suffix}}, v8Undefined(), signature, {{method.length}});
// Return the function by default, unless the user script has overwritten it.
v8SetReturnValue(info, methodTemplate->GetFunction(info.GetIsolate()->GetCurrentContext()).ToLocalChecked());
@@ -545,8 +545,10 @@ static void {{method.name}}OriginSafeMethodGetter{{world_suffix}}(const v8::Prop
v8SetReturnValue(info, hiddenValue);
}
}
+{% endmacro %}
-{{exported}} void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) {
+{% macro origin_safe_method_getter_callback(method, world_suffix) %}
+void {{v8_class_or_partial}}::{{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>& info) {
{{cpp_class}}V8Internal::{{method.name}}OriginSafeMethodGetter{{world_suffix}}(info);
}
{% endmacro %}
@@ -599,10 +601,10 @@ v8SetReturnValue(info, wrapper);
{% macro method_configuration(method) %}
{% from 'utilities.cpp.tmpl' import property_location %}
{% set method_callback =
- '%sV8Internal::%sMethodCallback' % (cpp_class_or_partial, method.name) %}
+ '%s::%sMethodCallback' % (v8_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' %}
+ '%s::%sMethodCallbackForMainWorld' % (v8_class_or_partial, method.name)
+ if method.is_per_world_bindings else 'nullptr' %}
{% set property_attribute =
'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attributes)
if method.property_attributes else 'v8::None' %}

Powered by Google App Engine
This is Rietveld 408576698