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 #include "config.h" |
| 8 #include "TestInterfaceOrTestInterfaceEmpty.h" |
| 9 |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 TestInterfaceOrTestInterfaceEmpty::TestInterfaceOrTestInterfaceEmpty() |
| 14 : m_type(SpecificTypeNone) |
| 15 { |
| 16 } |
| 17 |
| 18 PassRefPtr<TestInterfaceImplementation> TestInterfaceOrTestInterfaceEmpty::getAs
TestInterface() const |
| 19 { |
| 20 ASSERT(isTestInterface()); |
| 21 return m_testInterface; |
| 22 } |
| 23 |
| 24 void TestInterfaceOrTestInterfaceEmpty::setTestInterface(PassRefPtr<TestInterfac
eImplementation> value) |
| 25 { |
| 26 ASSERT(isNull()); |
| 27 m_testInterface = value; |
| 28 m_type = SpecificTypeTestInterface; |
| 29 } |
| 30 |
| 31 TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInt
erface(PassRefPtr<TestInterfaceImplementation> value) |
| 32 { |
| 33 TestInterfaceOrTestInterfaceEmpty container; |
| 34 container.setTestInterface(value); |
| 35 return container; |
| 36 } |
| 37 |
| 38 PassRefPtr<TestInterfaceEmpty> TestInterfaceOrTestInterfaceEmpty::getAsTestInter
faceEmpty() const |
| 39 { |
| 40 ASSERT(isTestInterfaceEmpty()); |
| 41 return m_testInterfaceEmpty; |
| 42 } |
| 43 |
| 44 void TestInterfaceOrTestInterfaceEmpty::setTestInterfaceEmpty(PassRefPtr<TestInt
erfaceEmpty> value) |
| 45 { |
| 46 ASSERT(isNull()); |
| 47 m_testInterfaceEmpty = value; |
| 48 m_type = SpecificTypeTestInterfaceEmpty; |
| 49 } |
| 50 |
| 51 TestInterfaceOrTestInterfaceEmpty TestInterfaceOrTestInterfaceEmpty::fromTestInt
erfaceEmpty(PassRefPtr<TestInterfaceEmpty> value) |
| 52 { |
| 53 TestInterfaceOrTestInterfaceEmpty container; |
| 54 container.setTestInterfaceEmpty(value); |
| 55 return container; |
| 56 } |
| 57 |
| 58 void V8TestInterfaceOrTestInterfaceEmpty::toImpl(v8::Isolate* isolate, v8::Local
<v8::Value> v8Value, TestInterfaceOrTestInterfaceEmpty& impl, ExceptionState& ex
ceptionState) |
| 59 { |
| 60 if (v8Value.IsEmpty()) |
| 61 return; |
| 62 |
| 63 if (V8TestInterface::hasInstance(v8Value, isolate)) { |
| 64 RefPtr<TestInterfaceImplementation> cppValue = V8TestInterface::toImpl(v
8::Local<v8::Object>::Cast(v8Value)); |
| 65 impl.setTestInterface(cppValue); |
| 66 return; |
| 67 } |
| 68 |
| 69 if (V8TestInterfaceEmpty::hasInstance(v8Value, isolate)) { |
| 70 RefPtr<TestInterfaceEmpty> cppValue = V8TestInterfaceEmpty::toImpl(v8::L
ocal<v8::Object>::Cast(v8Value)); |
| 71 impl.setTestInterfaceEmpty(cppValue); |
| 72 return; |
| 73 } |
| 74 |
| 75 exceptionState.throwTypeError("The provided value is not of type '(TestInter
face or TestInterfaceEmpty)'"); |
| 76 } |
| 77 |
| 78 v8::Local<v8::Value> toV8(const TestInterfaceOrTestInterfaceEmpty& impl, v8::Loc
al<v8::Object> creationContext, v8::Isolate* isolate) |
| 79 { |
| 80 switch (impl.m_type) { |
| 81 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeNone: |
| 82 return v8::Null(isolate); |
| 83 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterface: |
| 84 return toV8(impl.getAsTestInterface(), creationContext, isolate); |
| 85 case TestInterfaceOrTestInterfaceEmpty::SpecificTypeTestInterfaceEmpty: |
| 86 return toV8(impl.getAsTestInterfaceEmpty(), creationContext, isolate); |
| 87 default: |
| 88 ASSERT_NOT_REACHED(); |
| 89 } |
| 90 return v8::Local<v8::Value>(); |
| 91 } |
| 92 |
| 93 TestInterfaceOrTestInterfaceEmpty NativeValueTraits<TestInterfaceOrTestInterface
Empty>::nativeValue(const v8::Local<v8::Value>& value, v8::Isolate* isolate, Exc
eptionState& exceptionState) |
| 94 { |
| 95 TestInterfaceOrTestInterfaceEmpty impl; |
| 96 V8TestInterfaceOrTestInterfaceEmpty::toImpl(isolate, value, impl, exceptionS
tate); |
| 97 return impl; |
| 98 } |
| 99 |
| 100 } // namespace blink |
OLD | NEW |