summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl')
-rw-r--r--chromium/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl28
1 files changed, 15 insertions, 13 deletions
diff --git a/chromium/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl b/chromium/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl
index 2fdb7be87fb..fa259312cb5 100644
--- a/chromium/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl
+++ b/chromium/third_party/blink/renderer/bindings/templates/callback_interface.h.tmpl
@@ -14,31 +14,34 @@ namespace blink {
class {{forward_declaration}};
{% endfor %}
+{% if is_legacy_callback_interface %}
+{{exported}}extern const WrapperTypeInfo {{snake_case_v8_class}}_wrapper_type_info;
+{% endif %}
+
class {{exported}}{{v8_class}} final : public CallbackInterfaceBase {
public:
{% if is_legacy_callback_interface %}
// Support of "legacy callback interface"
static v8::Local<v8::FunctionTemplate> DomTemplate(v8::Isolate*, const DOMWrapperWorld&);
- static const WrapperTypeInfo wrapper_type_info;
+ static constexpr const WrapperTypeInfo* GetWrapperTypeInfo() {
+ return &{{snake_case_v8_class}}_wrapper_type_info;
+ }
+
// Constants
{% for constant in constants %}
static constexpr {{constant.cpp_type}} {{constant.name}} = {{constant.value}};
{% endfor %}
{% endif %}
- // Creates and returns a new instance. Returns nullptr when |callback_object|
- // is an object in a remote context (e.g. cross origin window object). The
- // call sites may want to throw a SecurityError in the case.
- // See also crbug.com/886588
- static {{v8_class}}* CreateOrNull(v8::Local<v8::Object> callback_object);
+ static {{v8_class}}* Create(v8::Local<v8::Object> callback_object) {
+ return MakeGarbageCollected<{{v8_class}}>(callback_object);
+ }
{% set single_operation_enum_value =
'kSingleOperation' if is_single_operation_callback_interface else
'kNotSingleOperation' %}
- explicit {{v8_class}}(
- v8::Local<v8::Object> callback_object,
- v8::Local<v8::Context> callback_object_creation_context)
- : CallbackInterfaceBase(callback_object, callback_object_creation_context,
+ explicit {{v8_class}}(v8::Local<v8::Object> callback_object)
+ : CallbackInterfaceBase(callback_object,
{{single_operation_enum_value}}) {}
~{{v8_class}}() override = default;
@@ -79,6 +82,8 @@ class V8PersistentCallbackInterface<{{v8_class}}> final : public V8PersistentCal
using V8CallbackInterface = {{v8_class}};
public:
+ explicit V8PersistentCallbackInterface(V8CallbackInterface* callback_interface)
+ : V8PersistentCallbackInterfaceBase(callback_interface) {}
~V8PersistentCallbackInterface() override = default;
{% for method in methods %}
@@ -89,9 +94,6 @@ class V8PersistentCallbackInterface<{{v8_class}}> final : public V8PersistentCal
{% endif %}
private:
- explicit V8PersistentCallbackInterface(V8CallbackInterface* callback_interface)
- : V8PersistentCallbackInterfaceBase(callback_interface) {}
-
V8CallbackInterface* Proxy() {
return As<V8CallbackInterface>();
}