blob: 6a1f1e81f8f985fd35ffa93d1575215debb029f0 [file] [log] [blame]
{% filter format_blink_cpp_source_code %}
{% include 'copyright_block.txt' %}
#ifndef {{v8_class}}_h
#define {{v8_class}}_h
{% for filename in header_includes %}
#include "{{filename}}"
{% endfor %}
namespace blink {
{# TODO(yukishiino): Stop inheriting {{cpp_class}} as it\'s not necessary for
most cases. Those who need a common base class between this class and
another class should define an adapter class for themselves. #}
class {{exported}}{{v8_class}} final
: public {{cpp_class}},
public CallbackInterfaceBase {
public:
static {{v8_class}}* Create(v8::Local<v8::Object> callback_object) {
return new {{v8_class}}(callback_object);
}
~{{v8_class}}() override = default;
{% for method in methods %}
{# TODO(yukishiino): Add |ScriptWrappable* callback_this_value| as the first
argument of the IDL operations. The callsites must pass callback_this_value
explicitly. #}
{# TODO(yukishiino): Change the return type to v8::Maybe<T> so that the
function returns a return value or throws an exception. #}
// Performs "call a user object's operation".
// https://heycam.github.io/webidl/#call-a-user-objects-operation
{{method.cpp_type}} {{method.name}}({{method.argument_declarations | join(', ')}}) override;
{% endfor %}
private:
{% set single_operation_enum_value =
'kSingleOperation' if is_single_operation_callback_interface else
'kNotSingleOperation' %}
explicit {{v8_class}}(v8::Local<v8::Object> callback_object)
: CallbackInterfaceBase(callback_object, {{single_operation_enum_value}}) {}
};
} // namespace blink
#endif // {{v8_class}}_h
{% endfilter %}{# format_blink_cpp_source_code #}