summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/bindings/templates/union_container.h.tmpl
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/blink/renderer/bindings/templates/union_container.h.tmpl')
-rw-r--r--chromium/third_party/blink/renderer/bindings/templates/union_container.h.tmpl89
1 files changed, 0 insertions, 89 deletions
diff --git a/chromium/third_party/blink/renderer/bindings/templates/union_container.h.tmpl b/chromium/third_party/blink/renderer/bindings/templates/union_container.h.tmpl
deleted file mode 100644
index 374868f4419..00000000000
--- a/chromium/third_party/blink/renderer/bindings/templates/union_container.h.tmpl
+++ /dev/null
@@ -1,89 +0,0 @@
-{% filter format_blink_cpp_source_code %}
-
-{% include 'copyright_block.txt' %}
-#ifndef {{header_guard}}
-#define {{header_guard}}
-
-{% for filename in header_includes %}
-#include "{{filename}}"
-{% endfor %}
-
-namespace blink {
-
-{% for decl in header_forward_decls %}
-class {{decl}};
-{% endfor %}
-
-class {{exported}}{{cpp_class}} final {
- DISALLOW_NEW();
- public:
- {{cpp_class}}();
- bool IsNull() const { return type_ == SpecificType::kNone; }
-
- {% for member in members %}
- bool Is{{member.type_name}}() const { return type_ == SpecificType::{{member.specific_type_enum}}; }
- {{member.rvalue_cpp_type}} GetAs{{member.type_name}}() const;
- void Set{{member.type_name}}({{member.rvalue_cpp_type}});
- static {{cpp_class}} From{{member.type_name}}({{member.rvalue_cpp_type}});
-
- {% endfor %}
- {{cpp_class}}(const {{cpp_class}}&);
- ~{{cpp_class}}();
- {{cpp_class}}& operator=(const {{cpp_class}}&);
- void Trace(Visitor*) const;
-
- private:
- enum class SpecificType {
- kNone,
- {% for member in members %}
- {{member.specific_type_enum}},
- {% endfor %}
- };
- SpecificType type_;
-
- {% for member in members %}
- {{member.cpp_type}} {{member.cpp_name}}_;
- {% endfor %}
-
- friend {{exported}}v8::Local<v8::Value> ToV8(const {{cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*);
-};
-
-class {{v8_class}} final {
- public:
- {{exported}}static void ToImpl(v8::Isolate*, v8::Local<v8::Value>, {{cpp_class}}&, UnionTypeConversionMode, ExceptionState&);
-};
-
-{{exported}}v8::Local<v8::Value> ToV8(const {{cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*);
-
-template <class CallbackInfo>
-inline void V8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class}}& impl) {
- V8SetReturnValue(callbackInfo, ToV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
-}
-
-template <class CallbackInfo>
-inline void V8SetReturnValue(const CallbackInfo& callbackInfo, {{cpp_class}}& impl, v8::Local<v8::Object> creationContext) {
- V8SetReturnValue(callbackInfo, ToV8(impl, creationContext, callbackInfo.GetIsolate()));
-}
-
-template <>
-struct NativeValueTraits<{{cpp_class}}> : public NativeValueTraitsBase<{{cpp_class}}> {
- {{exported}}static {{cpp_class}} NativeValue(v8::Isolate*, v8::Local<v8::Value>, ExceptionState&);
- {{exported}}static {{cpp_class}} NullValue() { return {{cpp_class}}(); }
-};
-
-template <>
-struct V8TypeOf<{{cpp_class}}> {
- typedef {{v8_class}} Type;
-};
-
-} // namespace blink
-
-// We need to set canInitializeWithMemset=true because HeapVector supports
-// items that can initialize with memset or have a vtable. It is safe to
-// set canInitializeWithMemset=true for a union type object in practice.
-// See https://codereview.chromium.org/1118993002/#msg5 for more details.
-WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::{{cpp_class}})
-
-#endif // {{header_guard}}
-
-{% endfilter %}{# format_blink_cpp_source_code #}