OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 |
| 7 #ifndef TestInterfaceOrLong_h |
| 8 #define TestInterfaceOrLong_h |
| 9 |
| 10 #include "bindings/core/v8/Dictionary.h" |
| 11 #include "bindings/core/v8/ExceptionState.h" |
| 12 #include "bindings/core/v8/V8Binding.h" |
| 13 #include "core/CoreExport.h" |
| 14 #include "platform/heap/Handle.h" |
| 15 |
| 16 namespace blink { |
| 17 |
| 18 class TestInterfaceImplementation; |
| 19 |
| 20 class CORE_EXPORT TestInterfaceOrLong final { |
| 21 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 22 public: |
| 23 TestInterfaceOrLong(); |
| 24 bool isNull() const { return m_type == SpecificTypeNone; } |
| 25 |
| 26 bool isTestInterface() const { return m_type == SpecificTypeTestInterface; } |
| 27 TestInterfaceImplementation* getAsTestInterface() const; |
| 28 void setTestInterface(TestInterfaceImplementation*); |
| 29 static TestInterfaceOrLong fromTestInterface(TestInterfaceImplementation*); |
| 30 |
| 31 bool isLong() const { return m_type == SpecificTypeLong; } |
| 32 int getAsLong() const; |
| 33 void setLong(int); |
| 34 static TestInterfaceOrLong fromLong(int); |
| 35 |
| 36 TestInterfaceOrLong(const TestInterfaceOrLong&); |
| 37 ~TestInterfaceOrLong(); |
| 38 TestInterfaceOrLong& operator=(const TestInterfaceOrLong&); |
| 39 DECLARE_TRACE(); |
| 40 |
| 41 private: |
| 42 enum SpecificTypes { |
| 43 SpecificTypeNone, |
| 44 SpecificTypeTestInterface, |
| 45 SpecificTypeLong, |
| 46 }; |
| 47 SpecificTypes m_type; |
| 48 |
| 49 Member<TestInterfaceImplementation> m_testInterface; |
| 50 int m_long; |
| 51 |
| 52 friend CORE_EXPORT v8::Local<v8::Value> toV8(const TestInterfaceOrLong&, v8:
:Local<v8::Object>, v8::Isolate*); |
| 53 }; |
| 54 |
| 55 class V8TestInterfaceOrLong final { |
| 56 public: |
| 57 CORE_EXPORT static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInter
faceOrLong&, UnionTypeConversionMode, ExceptionState&); |
| 58 }; |
| 59 |
| 60 CORE_EXPORT v8::Local<v8::Value> toV8(const TestInterfaceOrLong&, v8::Local<v8::
Object>, v8::Isolate*); |
| 61 |
| 62 template <class CallbackInfo> |
| 63 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceOrLo
ng& impl) |
| 64 { |
| 65 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 66 } |
| 67 |
| 68 template <> |
| 69 struct NativeValueTraits<TestInterfaceOrLong> { |
| 70 CORE_EXPORT static TestInterfaceOrLong nativeValue(v8::Isolate*, v8::Local<v
8::Value>, ExceptionState&); |
| 71 }; |
| 72 |
| 73 } // namespace blink |
| 74 |
| 75 // We need to set canInitializeWithMemset=true because HeapVector supports |
| 76 // items that can initialize with memset or have a vtable. It is safe to |
| 77 // set canInitializeWithMemset=true for a union type object in practice. |
| 78 // See https://codereview.chromium.org/1118993002/#msg5 for more details. |
| 79 WTF_ALLOW_MOVE_AND_INIT_WITH_MEM_FUNCTIONS(blink::TestInterfaceOrLong); |
| 80 |
| 81 #endif // TestInterfaceOrLong_h |
OLD | NEW |