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 StringOrArrayBufferOrArrayBufferView_h |
| 8 #define StringOrArrayBufferOrArrayBufferView_h |
| 9 |
| 10 #include "bindings/core/v8/Dictionary.h" |
| 11 #include "bindings/core/v8/ExceptionState.h" |
| 12 #include "bindings/core/v8/V8ArrayBuffer.h" |
| 13 #include "bindings/core/v8/V8ArrayBufferView.h" |
| 14 #include "bindings/core/v8/V8Binding.h" |
| 15 #include "platform/heap/Handle.h" |
| 16 |
| 17 namespace blink { |
| 18 |
| 19 class StringOrArrayBufferOrArrayBufferView final { |
| 20 ALLOW_ONLY_INLINE_ALLOCATION(); |
| 21 public: |
| 22 StringOrArrayBufferOrArrayBufferView(); |
| 23 bool isNull() const { return m_type == SpecificTypeNone; } |
| 24 |
| 25 bool isString() const { return m_type == SpecificTypeString; } |
| 26 String getAsString() const; |
| 27 void setString(String); |
| 28 static StringOrArrayBufferOrArrayBufferView fromString(String); |
| 29 |
| 30 bool isArrayBuffer() const { return m_type == SpecificTypeArrayBuffer; } |
| 31 PassRefPtr<TestArrayBuffer> getAsArrayBuffer() const; |
| 32 void setArrayBuffer(PassRefPtr<TestArrayBuffer>); |
| 33 static StringOrArrayBufferOrArrayBufferView fromArrayBuffer(PassRefPtr<TestA
rrayBuffer>); |
| 34 |
| 35 bool isArrayBufferView() const { return m_type == SpecificTypeArrayBufferVie
w; } |
| 36 PassRefPtr<TestArrayBufferView> getAsArrayBufferView() const; |
| 37 void setArrayBufferView(PassRefPtr<TestArrayBufferView>); |
| 38 static StringOrArrayBufferOrArrayBufferView fromArrayBufferView(PassRefPtr<T
estArrayBufferView>); |
| 39 |
| 40 private: |
| 41 enum SpecificTypes { |
| 42 SpecificTypeNone, |
| 43 SpecificTypeString, |
| 44 SpecificTypeArrayBuffer, |
| 45 SpecificTypeArrayBufferView, |
| 46 }; |
| 47 SpecificTypes m_type; |
| 48 |
| 49 String m_string; |
| 50 RefPtr<TestArrayBuffer> m_arrayBuffer; |
| 51 RefPtr<TestArrayBufferView> m_arrayBufferView; |
| 52 |
| 53 friend v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView&
, v8::Local<v8::Object>, v8::Isolate*); |
| 54 }; |
| 55 |
| 56 class V8StringOrArrayBufferOrArrayBufferView final { |
| 57 public: |
| 58 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, StringOrArrayBufferOr
ArrayBufferView&, ExceptionState&); |
| 59 }; |
| 60 |
| 61 v8::Local<v8::Value> toV8(const StringOrArrayBufferOrArrayBufferView&, v8::Local
<v8::Object>, v8::Isolate*); |
| 62 |
| 63 template <class CallbackInfo> |
| 64 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, StringOrArrayBuff
erOrArrayBufferView& impl) |
| 65 { |
| 66 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); |
| 67 } |
| 68 |
| 69 template <> |
| 70 struct NativeValueTraits<StringOrArrayBufferOrArrayBufferView> { |
| 71 static StringOrArrayBufferOrArrayBufferView nativeValue(const v8::Local<v8::
Value>&, v8::Isolate*, ExceptionState&); |
| 72 }; |
| 73 |
| 74 } // namespace blink |
| 75 |
| 76 #endif // StringOrArrayBufferOrArrayBufferView_h |
OLD | NEW |