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

Unified Diff: third_party/WebKit/Source/bindings/templates/interface.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/interface.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
index a7e7b2ecbddb5cbcc66f4c711f6351ebb845ecc9..aadd9d15be97de03e1d1701803b9cfd5ddcbbd9d 100644
--- a/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/interface.cpp.tmpl
@@ -48,7 +48,7 @@ static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
{% block indexed_property_getter_callback %}
{% if indexed_property_getter or named_property_getter %}
{% set getter = indexed_property_getter or named_property_getter %}
-{{exported}}void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
+void {{v8_class_or_partial}}::indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) {
{% if indexed_property_getter %}
{% if getter.is_custom %}
@@ -122,7 +122,7 @@ static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
{% block indexed_property_setter_callback %}
{% if indexed_property_setter or named_property_setter %}
{% set setter = indexed_property_setter or named_property_setter %}
-{{exported}}void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
+void {{v8_class_or_partial}}::indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
{% if setter.is_ce_reactions %}
CEReactionsScope ceReactionsScope;
{% endif %}
@@ -190,7 +190,7 @@ static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf
{% block indexed_property_deleter_callback %}
{% if indexed_property_deleter or named_property_deleter %}
{% set deleter = indexed_property_deleter or named_property_deleter %}
-{{exported}}void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
+void {{v8_class_or_partial}}::indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
{% if deleter.is_ce_reactions %}
CEReactionsScope ceReactionsScope;
{% endif %}
@@ -253,7 +253,7 @@ static void namedPropertyGetter(const AtomicString& name, const v8::PropertyCall
{% block named_property_getter_callback %}
{% if named_property_getter %}
{% set getter = named_property_getter %}
-{{exported}}void namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
+void {{v8_class_or_partial}}::namedPropertyGetterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
if (!name->IsString())
return;
const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
@@ -320,7 +320,7 @@ static void namedPropertySetter(const AtomicString& name, v8::Local<v8::Value> v
{% block named_property_setter_callback %}
{% if named_property_setter %}
{% set setter = named_property_setter %}
-{{exported}}void namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
+void {{v8_class_or_partial}}::namedPropertySetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) {
if (!name->IsString())
return;
const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
@@ -381,7 +381,7 @@ static void namedPropertyDeleter(const AtomicString& name, const v8::PropertyCal
{% block named_property_deleter_callback %}
{% if named_property_deleter %}
{% set deleter = named_property_deleter %}
-{{exported}}void namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
+void {{v8_class_or_partial}}::namedPropertyDeleterCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Boolean>& info) {
if (!name->IsString())
return;
const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
@@ -435,7 +435,7 @@ static void namedPropertyQuery(const AtomicString& name, const v8::PropertyCallb
{% block named_property_query_callback %}
{% if named_property_getter and named_property_getter.is_enumerable %}
{% set getter = named_property_getter %}
-{{exported}}void namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
+void {{v8_class_or_partial}}::namedPropertyQueryCallback(v8::Local<v8::Name> name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
if (!name->IsString())
return;
const AtomicString& propertyName = toCoreAtomicString(name.As<v8::String>());
@@ -475,7 +475,7 @@ static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
{% block named_property_enumerator_callback %}
{% if named_property_getter and named_property_getter.is_enumerable %}
{% set getter = named_property_getter %}
-{{exported}}void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info) {
+void {{v8_class_or_partial}}::namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::Array>& info) {
{% if getter.is_custom_property_enumerator %}
{{v8_class}}::namedPropertyEnumeratorCustom(info);
{% else %}
@@ -509,11 +509,14 @@ static void {{cpp_class}}OriginSafeMethodSetter(v8::Local<v8::Name> name, v8::Lo
{# The findInstanceInPrototypeChain() call above only returns a non-empty handle if info.Holder() is an Object. #}
V8HiddenValue::setHiddenValue(ScriptState::current(info.GetIsolate()), v8::Local<v8::Object>::Cast(info.Holder()), name.As<v8::String>(), v8Value);
}
+{% endif %}
+{% endblock %}
-{{exported}}void {{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) {
+{% block origin_safe_method_setter_callback %}
+{% if has_origin_safe_method_setter %}
+void {{v8_class_or_partial}}::{{cpp_class}}OriginSafeMethodSetterCallback(v8::Local<v8::Name> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info) {
{{cpp_class}}V8Internal::{{cpp_class}}OriginSafeMethodSetter(name, v8Value, info);
}
-
{% endif %}
{% endblock %}
@@ -665,18 +668,18 @@ void {{v8_class}}::constructorCallback(const v8::FunctionCallbackInfo<v8::Value>
realm as a hack to support the incumbent realm. Clean this up when Blink
properly supports the incumbent realm. #}
{% set getter_callback =
- '%sV8Internal::%sOriginSafeMethodGetterCallback%s' %
- (cpp_class, method.name, world_suffix) %}
+ '%s::%sOriginSafeMethodGetterCallback%s' %
+ (v8_class_or_partial, method.name, world_suffix) %}
{% set setter_callback =
- '{0}V8Internal::{0}OriginSafeMethodSetterCallback'.format(cpp_class)
- if not method.is_unforgeable else '0' %}
+ '%s::%sOriginSafeMethodSetterCallback' % (v8_class_or_partial, cpp_class)
+ if not method.is_unforgeable else 'nullptr' %}
{% if method.is_per_world_bindings %}
{% set getter_callback_for_main_world = '%sForMainWorld' % getter_callback %}
{% set setter_callback_for_main_world = '%sForMainWorld' % setter_callback
- if not method.is_unforgeable else '0' %}
+ if not method.is_unforgeable else 'nullptr' %}
{% else %}
-{% set getter_callback_for_main_world = '0' %}
-{% set setter_callback_for_main_world = '0' %}
+{% set getter_callback_for_main_world = 'nullptr' %}
+{% set setter_callback_for_main_world = 'nullptr' %}
{% endif %}
{% set property_attribute =
'static_cast<v8::PropertyAttribute>(%s)' %
@@ -692,17 +695,17 @@ V8DOMConfiguration::installAttribute(isolate, world, {{instance_template}}, {{pr
{##############################################################################}
{% macro install_indexed_property_handler(target) %}
{% set indexed_property_getter_callback =
- '%sV8Internal::indexedPropertyGetterCallback' % cpp_class %}
+ '%s::indexedPropertyGetterCallback' % v8_class_or_partial %}
{% set indexed_property_setter_callback =
- '%sV8Internal::indexedPropertySetterCallback' % cpp_class
- if indexed_property_setter or named_property_setter else '0' %}
-{% set indexed_property_query_callback = '0' %}{# Unused #}
+ '%s::indexedPropertySetterCallback' % v8_class_or_partial
+ if indexed_property_setter or named_property_setter else 'nullptr' %}
+{% set indexed_property_query_callback = 'nullptr' %}{# Unused #}
{% set indexed_property_deleter_callback =
- '%sV8Internal::indexedPropertyDeleterCallback' % cpp_class
- if indexed_property_deleter or named_property_deleter else '0' %}
+ '%s::indexedPropertyDeleterCallback' % v8_class_or_partial
+ if indexed_property_deleter or named_property_deleter else 'nullptr' %}
{% set indexed_property_enumerator_callback =
'indexedPropertyEnumerator<%s>' % cpp_class
- if indexed_property_getter.is_enumerable else '0' %}
+ if indexed_property_getter.is_enumerable else 'nullptr' %}
{% set property_handler_flags =
'v8::PropertyHandlerFlags::kNone' %}
v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig({{indexed_property_getter_callback}}, {{indexed_property_setter_callback}}, {{indexed_property_query_callback}}, {{indexed_property_deleter_callback}}, {{indexed_property_enumerator_callback}}, v8::Local<v8::Value>(), {{property_handler_flags}});
@@ -713,19 +716,19 @@ v8::IndexedPropertyHandlerConfiguration indexedPropertyHandlerConfig({{indexed_p
{##############################################################################}
{% macro install_named_property_handler(target) %}
{% set named_property_getter_callback =
- '%sV8Internal::namedPropertyGetterCallback' % cpp_class %}
+ '%s::namedPropertyGetterCallback' % v8_class_or_partial %}
{% set named_property_setter_callback =
- '%sV8Internal::namedPropertySetterCallback' % cpp_class
- if named_property_setter else '0' %}
+ '%s::namedPropertySetterCallback' % v8_class_or_partial
+ if named_property_setter else 'nullptr' %}
{% set named_property_query_callback =
- '%sV8Internal::namedPropertyQueryCallback' % cpp_class
- if named_property_getter.is_enumerable else '0' %}
+ '%s::namedPropertyQueryCallback' % v8_class_or_partial
+ if named_property_getter.is_enumerable else 'nullptr' %}
{% set named_property_deleter_callback =
- '%sV8Internal::namedPropertyDeleterCallback' % cpp_class
- if named_property_deleter else '0' %}
+ '%s::namedPropertyDeleterCallback' % v8_class_or_partial
+ if named_property_deleter else 'nullptr' %}
{% set named_property_enumerator_callback =
- '%sV8Internal::namedPropertyEnumeratorCallback' % cpp_class
- if named_property_getter.is_enumerable else '0' %}
+ '%s::namedPropertyEnumeratorCallback' % v8_class_or_partial
+ if named_property_getter.is_enumerable else 'nullptr' %}
{% set property_handler_flags_list =
['int(v8::PropertyHandlerFlags::kOnlyInterceptStrings)'] %}
{% if not is_override_builtins %}

Powered by Google App Engine
This is Rietveld 408576698