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 "TestInterface2OrUint8Array.h" |
| 9 |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 TestInterface2OrUint8Array::TestInterface2OrUint8Array() |
| 14 : m_type(SpecificTypeNone) |
| 15 { |
| 16 } |
| 17 |
| 18 PassRefPtr<TestInterface2> TestInterface2OrUint8Array::getAsTestInterface2() con
st |
| 19 { |
| 20 ASSERT(isTestInterface2()); |
| 21 return m_testInterface2; |
| 22 } |
| 23 |
| 24 void TestInterface2OrUint8Array::setTestInterface2(PassRefPtr<TestInterface2> va
lue) |
| 25 { |
| 26 ASSERT(isNull()); |
| 27 m_testInterface2 = value; |
| 28 m_type = SpecificTypeTestInterface2; |
| 29 } |
| 30 |
| 31 TestInterface2OrUint8Array TestInterface2OrUint8Array::fromTestInterface2(PassRe
fPtr<TestInterface2> value) |
| 32 { |
| 33 TestInterface2OrUint8Array container; |
| 34 container.setTestInterface2(value); |
| 35 return container; |
| 36 } |
| 37 |
| 38 PassRefPtr<DOMUint8Array> TestInterface2OrUint8Array::getAsUint8Array() const |
| 39 { |
| 40 ASSERT(isUint8Array()); |
| 41 return m_uint8Array; |
| 42 } |
| 43 |
| 44 void TestInterface2OrUint8Array::setUint8Array(PassRefPtr<DOMUint8Array> value) |
| 45 { |
| 46 ASSERT(isNull()); |
| 47 m_uint8Array = value; |
| 48 m_type = SpecificTypeUint8Array; |
| 49 } |
| 50 |
| 51 TestInterface2OrUint8Array TestInterface2OrUint8Array::fromUint8Array(PassRefPtr
<DOMUint8Array> value) |
| 52 { |
| 53 TestInterface2OrUint8Array container; |
| 54 container.setUint8Array(value); |
| 55 return container; |
| 56 } |
| 57 |
| 58 void V8TestInterface2OrUint8Array::toImpl(v8::Isolate* isolate, v8::Local<v8::Va
lue> v8Value, TestInterface2OrUint8Array& impl, ExceptionState& exceptionState) |
| 59 { |
| 60 if (v8Value.IsEmpty()) |
| 61 return; |
| 62 |
| 63 if (V8TestInterface2::hasInstance(v8Value, isolate)) { |
| 64 RefPtr<TestInterface2> cppValue = V8TestInterface2::toImpl(v8::Local<v8:
:Object>::Cast(v8Value)); |
| 65 impl.setTestInterface2(cppValue); |
| 66 return; |
| 67 } |
| 68 |
| 69 if (V8Uint8Array::hasInstance(v8Value, isolate)) { |
| 70 RefPtr<DOMUint8Array> cppValue = V8Uint8Array::toImpl(v8::Local<v8::Obje
ct>::Cast(v8Value)); |
| 71 impl.setUint8Array(cppValue); |
| 72 return; |
| 73 } |
| 74 |
| 75 exceptionState.throwTypeError("The provided value is not of type '(TestInter
face2 or Uint8Array)'"); |
| 76 } |
| 77 |
| 78 v8::Local<v8::Value> toV8(const TestInterface2OrUint8Array& impl, v8::Local<v8::
Object> creationContext, v8::Isolate* isolate) |
| 79 { |
| 80 switch (impl.m_type) { |
| 81 case TestInterface2OrUint8Array::SpecificTypeNone: |
| 82 return v8::Null(isolate); |
| 83 case TestInterface2OrUint8Array::SpecificTypeTestInterface2: |
| 84 return toV8(impl.getAsTestInterface2(), creationContext, isolate); |
| 85 case TestInterface2OrUint8Array::SpecificTypeUint8Array: |
| 86 return toV8(impl.getAsUint8Array(), creationContext, isolate); |
| 87 default: |
| 88 ASSERT_NOT_REACHED(); |
| 89 } |
| 90 return v8::Local<v8::Value>(); |
| 91 } |
| 92 |
| 93 TestInterface2OrUint8Array NativeValueTraits<TestInterface2OrUint8Array>::native
Value(const v8::Local<v8::Value>& value, v8::Isolate* isolate, ExceptionState& e
xceptionState) |
| 94 { |
| 95 TestInterface2OrUint8Array impl; |
| 96 V8TestInterface2OrUint8Array::toImpl(isolate, value, impl, exceptionState); |
| 97 return impl; |
| 98 } |
| 99 |
| 100 } // namespace blink |
OLD | NEW |