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 TestInterfaceGarbageCollectedOrString_h |
| 8 #define TestInterfaceGarbageCollectedOrString_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 TestInterfaceGarbageCollected; |
| 19 |
| 20 class CORE_EXPORT TestInterfaceGarbageCollectedOrString final { |
| 21 DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
| 22 public: |
| 23 TestInterfaceGarbageCollectedOrString(); |
| 24 bool isNull() const { return m_type == SpecificTypeNone; } |
| 25 |
| 26 bool isTestInterfaceGarbageCollected() const { return m_type == SpecificType
TestInterfaceGarbageCollected; } |
| 27 TestInterfaceGarbageCollected* getAsTestInterfaceGarbageCollected() const; |
| 28 void setTestInterfaceGarbageCollected(TestInterfaceGarbageCollected*); |
| 29 static TestInterfaceGarbageCollectedOrString fromTestInterfaceGarbageCollect
ed(TestInterfaceGarbageCollected*); |
| 30 |
| 31 bool isString() const { return m_type == SpecificTypeString; } |
| 32 String getAsString() const; |
| 33 void setString(String); |
| 34 static TestInterfaceGarbageCollectedOrString fromString(String); |
| 35 |
| 36 TestInterfaceGarbageCollectedOrString(const TestInterfaceGarbageCollectedOrS
tring&); |
| 37 ~TestInterfaceGarbageCollectedOrString(); |
| 38 TestInterfaceGarbageCollectedOrString& operator=(const TestInterfaceGarbageC
ollectedOrString&); |
| 39 DECLARE_TRACE(); |
| 40 |
| 41 private: |
| 42 enum SpecificTypes { |
| 43 SpecificTypeNone, |
| 44 SpecificTypeTestInterfaceGarbageCollected, |
| 45 SpecificTypeString, |
| 46 }; |
| 47 SpecificTypes m_type; |
| 48 |
| 49 Member<TestInterfaceGarbageCollected> m_testInterfaceGarbageCollected; |
| 50 String m_string; |
| 51 |
| 52 friend CORE_EXPORT v8::Local<v8::Value> toV8(const TestInterfaceGarbageColle
ctedOrString&, v8::Local<v8::Object>, v8::Isolate*); |
| 53 }; |
| 54 |
| 55 class V8TestInterfaceGarbageCollectedOrString final { |
| 56 public: |
| 57 CORE_EXPORT static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInter
faceGarbageCollectedOrString&, UnionTypeConversionMode, ExceptionState&); |
| 58 }; |
| 59 |
| 60 CORE_EXPORT v8::Local<v8::Value> toV8(const TestInterfaceGarbageCollectedOrStrin
g&, v8::Local<v8::Object>, v8::Isolate*); |
| 61 |
| 62 template <class CallbackInfo> |
| 63 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceGarb
ageCollectedOrString& impl) |
| 64 { |
| 65 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 66 } |
| 67 |
| 68 template <> |
| 69 struct NativeValueTraits<TestInterfaceGarbageCollectedOrString> { |
| 70 CORE_EXPORT static TestInterfaceGarbageCollectedOrString nativeValue(v8::Iso
late*, v8::Local<v8::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::TestInterfaceGarbageCollectedO
rString); |
| 80 |
| 81 #endif // TestInterfaceGarbageCollectedOrString_h |
OLD | NEW |