Chromium Code Reviews| Index: Source/bindings/templates/union.h |
| diff --git a/Source/bindings/templates/union.h b/Source/bindings/templates/union.h |
| index 77f70e996654ea5757e4f84fbae58d70f43287f3..651b64757916d250b0e8e4f8a12d5b0f1c6512b0 100644 |
| --- a/Source/bindings/templates/union.h |
| +++ b/Source/bindings/templates/union.h |
| @@ -7,13 +7,56 @@ |
| #ifndef {{macro_guard}} |
| #define {{macro_guard}} |
| +{% for filename in header_includes %} |
| +#include "{{filename}}" |
| +{% endfor %} |
| + |
| namespace blink { |
| +{% for decl in header_forward_decls %} |
| +class {{decl}}; |
| +{% endfor %} |
| + |
| {% for container in containers %} |
| class {{container.cpp_class}} final { |
| - // FIXME: Implement |
| + ALLOW_ONLY_INLINE_ALLOCATION(); |
|
sof
2014/10/31 06:48:20
Looks like this doesn't generate a trace() method,
sof
2014/10/31 06:52:23
Just to be clear(er),
s/required/required if t
Jens Widell
2014/10/31 07:24:02
https://codereview.chromium.org/689013002/
|
| +public: |
| + {{container.cpp_class}}(); |
| + bool isNull() const { return m_type == SpecificTypeNone; } |
| + |
| + {% for member in container.members %} |
| + bool is{{member.type_name}}() const { return m_type == {{member.specific_type_enum}}; } |
| + {{member.rvalue_cpp_type}} getAs{{member.type_name}}(); |
| + void set{{member.type_name}}({{member.rvalue_cpp_type}}); |
| + |
| + {% endfor %} |
| +private: |
| + enum SpecificTypes { |
| + SpecificTypeNone, |
| + {% for member in container.members %} |
| + {{member.specific_type_enum}}, |
| + {% endfor %} |
| + }; |
| + SpecificTypes m_type; |
| + |
| + {% for member in container.members %} |
| + {{member.cpp_type}} m_{{member.cpp_name}}; |
| + {% endfor %} |
| +}; |
| + |
| +class V8{{container.cpp_class}} final { |
| +public: |
| + static void toImpl(v8::Isolate*, v8::Handle<v8::Value>, {{container.cpp_class}}&, ExceptionState&); |
| }; |
| +v8::Handle<v8::Value> toV8({{container.cpp_class}}&, v8::Handle<v8::Object>, v8::Isolate*); |
| + |
| +template <class CallbackInfo> |
| +inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_class}}& impl) |
| +{ |
| + v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate())); |
| +} |
| + |
| {% endfor %} |
| } // namespace blink |