| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! |
| 6 | 6 |
| 7 #ifndef UnionTypeModules_h | 7 #ifndef UnionTypeModules_h |
| 8 #define UnionTypeModules_h | 8 #define UnionTypeModules_h |
| 9 | 9 |
| 10 #include "bindings/core/v8/Dictionary.h" | |
| 11 #include "bindings/core/v8/ExceptionState.h" | |
| 12 #include "bindings/core/v8/UnionTypesCore.h" | 10 #include "bindings/core/v8/UnionTypesCore.h" |
| 13 #include "bindings/core/v8/V8Binding.h" | 11 #include "bindings/modules/v8/BooleanOrString.h" |
| 14 #include "platform/heap/Handle.h" | |
| 15 | |
| 16 namespace blink { | |
| 17 | |
| 18 | |
| 19 class BooleanOrString final { | |
| 20 ALLOW_ONLY_INLINE_ALLOCATION(); | |
| 21 public: | |
| 22 BooleanOrString(); | |
| 23 bool isNull() const { return m_type == SpecificTypeNone; } | |
| 24 | |
| 25 bool isBoolean() const { return m_type == SpecificTypeBoolean; } | |
| 26 bool getAsBoolean() const; | |
| 27 void setBoolean(bool); | |
| 28 static BooleanOrString fromBoolean(bool); | |
| 29 | |
| 30 bool isString() const { return m_type == SpecificTypeString; } | |
| 31 String getAsString() const; | |
| 32 void setString(String); | |
| 33 static BooleanOrString fromString(String); | |
| 34 | |
| 35 private: | |
| 36 enum SpecificTypes { | |
| 37 SpecificTypeNone, | |
| 38 SpecificTypeBoolean, | |
| 39 SpecificTypeString, | |
| 40 }; | |
| 41 SpecificTypes m_type; | |
| 42 | |
| 43 bool m_boolean; | |
| 44 String m_string; | |
| 45 | |
| 46 friend v8::Local<v8::Value> toV8(const BooleanOrString&, v8::Local<v8::Objec
t>, v8::Isolate*); | |
| 47 }; | |
| 48 | |
| 49 class V8BooleanOrString final { | |
| 50 public: | |
| 51 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, BooleanOrString&, Exc
eptionState&); | |
| 52 }; | |
| 53 | |
| 54 v8::Local<v8::Value> toV8(const BooleanOrString&, v8::Local<v8::Object>, v8::Iso
late*); | |
| 55 | |
| 56 template <class CallbackInfo> | |
| 57 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, BooleanOrString&
impl) | |
| 58 { | |
| 59 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf
o.GetIsolate())); | |
| 60 } | |
| 61 | |
| 62 template <> | |
| 63 struct NativeValueTraits<BooleanOrString> { | |
| 64 static BooleanOrString nativeValue(const v8::Local<v8::Value>&, v8::Isolate*
, ExceptionState&); | |
| 65 }; | |
| 66 | |
| 67 } // namespace blink | |
| 68 | 12 |
| 69 #endif // UnionTypeModules_h | 13 #endif // UnionTypeModules_h |
| OLD | NEW |