OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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 "bindings/core/v8/V8TestInterface.h" |
| 14 #include "bindings/tests/idls/core/TestImplements2.h" |
| 15 #include "bindings/tests/idls/core/TestImplements3Implementation.h" |
| 16 #include "bindings/tests/idls/core/TestPartialInterface.h" |
| 17 #include "bindings/tests/idls/core/TestPartialInterfaceImplementation.h" |
| 18 #include "platform/heap/Handle.h" |
| 19 |
| 20 namespace blink { |
| 21 |
| 22 class TestInterfaceOrLong final { |
| 23 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 24 public: |
| 25 TestInterfaceOrLong(); |
| 26 bool isNull() const { return m_type == SpecificTypeNone; } |
| 27 |
| 28 bool isTestInterface() const { return m_type == SpecificTypeTestInterface; } |
| 29 PassRefPtr<TestInterfaceImplementation> getAsTestInterface() const; |
| 30 void setTestInterface(PassRefPtr<TestInterfaceImplementation>); |
| 31 static TestInterfaceOrLong fromTestInterface(PassRefPtr<TestInterfaceImpleme
ntation>); |
| 32 |
| 33 bool isLong() const { return m_type == SpecificTypeLong; } |
| 34 int getAsLong() const; |
| 35 void setLong(int); |
| 36 static TestInterfaceOrLong fromLong(int); |
| 37 |
| 38 private: |
| 39 enum SpecificTypes { |
| 40 SpecificTypeNone, |
| 41 SpecificTypeTestInterface, |
| 42 SpecificTypeLong, |
| 43 }; |
| 44 SpecificTypes m_type; |
| 45 |
| 46 RefPtr<TestInterfaceImplementation> m_testInterface; |
| 47 int m_long; |
| 48 |
| 49 friend v8::Local<v8::Value> toV8(const TestInterfaceOrLong&, v8::Local<v8::O
bject>, v8::Isolate*); |
| 50 }; |
| 51 |
| 52 class V8TestInterfaceOrLong final { |
| 53 public: |
| 54 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, TestInterfaceOrLong&,
ExceptionState&); |
| 55 }; |
| 56 |
| 57 v8::Local<v8::Value> toV8(const TestInterfaceOrLong&, v8::Local<v8::Object>, v8:
:Isolate*); |
| 58 |
| 59 template <class CallbackInfo> |
| 60 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, TestInterfaceOrLo
ng& impl) |
| 61 { |
| 62 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 63 } |
| 64 |
| 65 template <> |
| 66 struct NativeValueTraits<TestInterfaceOrLong> { |
| 67 static TestInterfaceOrLong nativeValue(const v8::Local<v8::Value>&, v8::Isol
ate*, ExceptionState&); |
| 68 }; |
| 69 |
| 70 } // namespace blink |
| 71 |
| 72 #endif // TestInterfaceOrLong_h |
OLD | NEW |